Author: gk
Date: Mon Dec 19 10:47:45 2016
New Revision: 1775052
URL: http://svn.apache.org/viewvc?rev=1775052&view=rev
Log:
- set intake as default
- update deps, README.txt
- add default i18n
- add license, notice
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/LICENSE (with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/NOTICE (with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
(with props)
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/pom.xml
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm
Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/LICENSE
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/LICENSE?rev=1775052&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/LICENSE (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/LICENSE Mon Dec 19
10:47:45 2016
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/NOTICE
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/NOTICE?rev=1775052&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/NOTICE (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/NOTICE Mon Dec 19
10:47:45 2016
@@ -0,0 +1,5 @@
+Turbine Webapp Component
+Copyright 2006-2016 The Apache Software Foundation.
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/NOTICE
------------------------------------------------------------------------------
svn:eol-style = native
Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/pom.xml
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/pom.xml?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/pom.xml (original)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/pom.xml Mon Dec 19
10:47:45 2016
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>17</version>
+ <version>18</version>
</parent>
<groupId>org.apache.turbine</groupId>
<artifactId>turbine-webapp-4.0</artifactId>
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
Mon Dec 19 10:47:45 2016
@@ -47,12 +47,13 @@ mvn archetype:generate \
-Dturbine_database_password=db_password \
-Dturbine_database_name=helloWorld \
-Dturbine_database_url=jdbc:mysql://localhost:3306/ \
- -Dgoals=generate-sources, sql:execute
+ -Dgoals=generate-sources,sql:execute
Notes
When invoking archetype:generate, you can already set mvn commands and you can
then skip them later.
-Be aware, when you set both mvn commands goals (-Dgoals=generate-sources,
sql:execute), you have to create the database before invoking the archetype
command.
+Be aware, when you set both mvn commands goals (-Dgoals=generate-sources,
sql:execute),
+you have to create the database (see below) BEFORE finishing the (interactive)
archetype commands.
Note that the database URL (turbine_database_url)
will be appended with your database name
@@ -68,10 +69,12 @@ Next, you need to create the database in
cd helloWorld
+# if not already done
mvn generate-sources ## This will generate the OM layer and SQL
## code for creating the corresponding
## database tables
-
+
+# if not already done
mvn sql:execute ## This executes the SQL code to create
## the application schema defined
## in src/main/torque-schema
@@ -86,6 +89,12 @@ Open a web browser to http://localhost:8
Login should work with user admin/password or user/password.
+Background:
+
+By default Intake is used as an validation mechanism for authentication. You
can change to the default login by settings
+
+action.login=LoginUser in TurbineResources.properties and changing Login.vm
appropriately (commented form)
+
To enable application development in Eclipse, run the following command
and then import the project into Eclipse.
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml
Mon Dec 19 10:47:45 2016
@@ -38,8 +38,12 @@ under the License.
<include>**/*.properties</include>
</includes>
</resource>
- <resource>
-
<targetPath>#var("project.build.directory")/torque/schema</targetPath>
+ <!-- (target) resource and filtering is not used at all ?
+ at least removed setting absolute path e.g. with
#var("project.build.directory"),
+ which does thrown an exception with mvn eclipse:eclipse - path is
then incorrectly relativized.
+ -->
+ <resource>
+ <targetPath>../torque/schema</targetPath>
<filtering>true</filtering>
<directory>src/main/torque-schema</directory>
<includes>
@@ -63,7 +67,7 @@ under the License.
<artifactId>torque-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
-
<schemaDir>#var("basedir")/src/main/torque-schema</schemaDir>
+
<schemaDir>#var("project.basedir")/src/main/torque-schema</schemaDir>
<useClasspath>true</useClasspath>
<runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
<targetDatabase>${turbine_database_adapter}</targetDatabase>
@@ -78,7 +82,7 @@ under the License.
<configuration>
<packaging>classpath</packaging>
<configPackage>org.apache.torque.templates.om</configPackage>
- <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir>
+
<sourceDir>#var("project.basedir")/src/main/torque-schema</sourceDir>
<loglevel>error</loglevel>
<options>
<torque.database>${turbine_database_adapter}</torque.database>
@@ -107,7 +111,7 @@ under the License.
<configuration>
<packaging>classpath</packaging>
<configPackage>org.apache.torque.templates.sql</configPackage>
- <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir>
+
<sourceDir>#var("project.basedir")/src/main/torque-schema</sourceDir>
<defaultOutputDir>#var("project.build.directory")/generated-sql/torque/mysql</defaultOutputDir>
<defaultOutputDirUsage>none</defaultOutputDirUsage>
<loglevel>error</loglevel>
@@ -155,7 +159,7 @@ under the License.
<password>${turbine_database_password}</password>
<onError>continue</onError>
<autocommit>true</autocommit>
- <orderFile>descending</orderFile>
+ <orderFile>ascending</orderFile>
<!-- this is mysql specific -->
<fileset>
<basedir>${project.build.directory}/generated-sql/torque/mysql</basedir>
@@ -246,7 +250,7 @@ under the License.
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-intake</artifactId>
- <version>1.2.0</version>
+ <version>1.2.2</version>
</dependency>
<!-- include some optional dependencies required in example
componentConfiguration.xml -->
<dependency>
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties?rev=1775052&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
Mon Dec 19 10:47:45 2016
@@ -0,0 +1,23 @@
+#*
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+*#
+l10nkey=Default value
+username_required_msg=Please enter an email address as user name
+username_min_length_msg=Please enter at least {0} characters
+username_mask_msg=Please enter a valid email address as user name
+password_msg=Please enter a password
\ No newline at end of file
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties?rev=1775052&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
Mon Dec 19 10:47:45 2016
@@ -0,0 +1,28 @@
+#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
+#*
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+l10nkey = German value
+
+password_msg = Bitte ein Passwort eingeben
+
+username_mask_msg = Geben Sie als Benutzername eine E-Mail-Adresse ein
+
+username_min_length_msg = Es m\u00FCssen {0} Zeichen eingegeben werden
+
+username_required_msg = Bitte einen Benutzernamen eingeben
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
Mon Dec 19 10:47:45 2016
@@ -16,4 +16,8 @@
# specific language governing permissions and limitations
# under the License.
*#
-l10nkey=US-English value
\ No newline at end of file
+l10nkey=US-English value
+username_required_msg=Please enter an email address as user name
+username_min_length_msg=Please enter at least {0} characters
+username_mask_msg=Please enter a valid email address as user name
+password_msg=Please enter a password
\ No newline at end of file
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java?rev=1775052&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
Mon Dec 19 10:47:45 2016
@@ -0,0 +1,183 @@
+package ${package}.modules.actions;
+
+#*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*#
+
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fulcrum.security.util.DataBackendException;
+import org.apache.fulcrum.security.util.FulcrumSecurityException;
+import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.fulcrum.intake.model.Group;
+import org.apache.fulcrum.intake.IntakeException;
+import org.apache.turbine.services.intake.IntakeTool;
+import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineConfiguration;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.modules.Action;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
+
+/**
+ * This is where we authenticate the user logging into the system
+ * against a user in the database. If the user exists in the database
+ * that users last login time will be updated.
+ *
+ * @author <a href="mailto:[email protected]">Dave Bryson</a>
+ * @author <a href="mailto:[email protected]">Henning P. Schmiedehausen</a>
+ * @author <a href="mailto:[email protected]">Quinton McCombs</a>
+ * @author <a href="mailto:[email protected]">Peter Courcoux</a>
+ * @version $Id$
+ */
+public class LoginUserIntake
+ extends org.apache.turbine.modules.actions.LoginUser
+{
+
+ /** Logging */
+ private static Log log = LogFactory.getLog(LoginUserIntake.class);
+
+ /** Injected service instance */
+ @TurbineService
+ private SecurityService security;
+
+ /** Injected configuration instance */
+ @TurbineConfiguration
+ private Configuration conf;
+
+
+
+ /**
+ * Checks for anonymous user, else calls parent method.
+ *
+ * @param pipelineData Turbine information.
+ * @exception FulcrumSecurityException could not get instance of the
+ * anonymous user
+ */
+ @Override
+ public void doPerform(PipelineData pipelineData)
+ throws FulcrumSecurityException
+ {
+ RunData data = getRunData(pipelineData);
+
+ try
+ {
+ // Get intake group
+ IntakeTool intake = new
IntakeTool();//(IntakeTool)context.get("intake");
+ intake.init(data);
+ Group group = intake.get("Login", IntakeTool.DEFAULT_KEY);
+ String username = (String)group.get("Username").getValue();
+ if (StringUtils.isEmpty(username))
+ {
+ return;
+ }
+
+ if (username.equals(security.getAnonymousUser().getName()))
+ {
+ data.setMessage("Anonymous user cannot login");
+ reset(data);
+ return;
+ }
+
+ if (username.equals(security.getAnonymousUser().getName()))
+ {
+ throw new Exception("Anonymous user cannot login");
+ }
+
+ String password = (String)group.get("Password").getValue();
+ // Authenticate the user and get the object.
+ User user = security.getAuthenticatedUser(username, password);
+
+ // Store the user object.
+ data.setUser(user);
+
+ // Mark the user as being logged in.
+ user.setHasLoggedIn(Boolean.TRUE);
+
+ // Set the last_login date in the database.
+ user.updateLastLogin();
+
+ // This only happens if the user is valid; otherwise, we
+ // will get a valueBound in the User object when we don't
+ // want to because the username is not set yet. Save the
+ // User object into the session.
+ data.save();
+
+ /*
+ * If the setPage("template.vm") method has not
+ * been used in the template to authenticate the
+ * user (usually Login.vm), then the user will
+ * be forwarded to the template that is specified
+ * by the "template.home" property as listed in
+ * TR.props for the webapp.
+ */
+
+ }
+ catch (Exception e)
+ {
+ if (e instanceof DataBackendException || e instanceof
IntakeException)
+ {
+ log.error(e);
+ }
+
+ // Set Error Message and clean out the user.
+ data.setMessage(conf.getString(TurbineConstants.LOGIN_ERROR, ""));
+ User anonymousUser = security.getAnonymousUser();
+ data.setUser(anonymousUser);
+
+ String loginTemplate = conf.getString(
+ TurbineConstants.TEMPLATE_LOGIN);
+
+ if (StringUtils.isNotEmpty(loginTemplate))
+ {
+ // We're running in a templating solution
+ data.setScreenTemplate(loginTemplate);
+ }
+ else
+ {
+ data.setScreen(conf.getString(TurbineConstants.SCREEN_LOGIN));
+ }
+ }
+ }
+
+
+
+ private void reset(RunData data) throws UnknownEntityException {
+ User anonymousUser = security.getAnonymousUser();
+ data.setUser(anonymousUser);
+
+ if
(StringUtils.isNotEmpty(conf.getString(TurbineConstants.TEMPLATE_LOGIN,"")))
+ {
+ // We're running in a templating solution
+ data.setScreenTemplate(
+
conf.getString(TurbineConstants.TEMPLATE_LOGIN));
+ }
+ else
+ {
+ data.setScreen(
+ conf.getString(TurbineConstants.SCREEN_LOGIN));
+ }
+ }
+
+}
+
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
Mon Dec 19 10:47:45 2016
@@ -212,7 +212,7 @@ default.html.doctype.url=http://www.w3.o
# implementation of the login action, make sure that you change this
# to reflect the new name.
-action.login=LoginUser
+action.login=LoginUserIntake
# This is the default action to log a user out. If you write your own
# implementation of the logout action, make sure that you change this
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml
Mon Dec 19 10:47:45 2016
@@ -31,4 +31,15 @@
<group name="example" key="example" mapToObject="om.Table1">
<field name="TestCol2" key="testCol2" type="String"/>
</group>
+ <group name="Login" key="login">
+ <field name="Username" key="u" type="String">
+ <!-- l10n keys -->
+ <rule name="required" value="true">username_required_msg</rule>
+ <rule name="minLength" value="4">username_min_length_msg</rule>
+ <!--rule name="mask" value=".+@.+\..+">username_mask_msg</rule-->
+ </field>
+ <field name="Password" key="p" type="String">
+ <rule name="required" value="true">password_msg</rule>
+ </field>
+</group>
</input-data>
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm?rev=1775052&r1=1775051&r2=1775052&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm
Mon Dec 19 10:47:45 2016
@@ -19,26 +19,54 @@
## If you want to use intake to process the data, uncomment below
##
-## #set ( $loginGroup = $intake.Login.Default )
-##
-## #if (!$loginGroup.Username.isValid() )
-## #info( "$loginGroup.Username.Message" )
-## #end
-##
-## #if ( !$loginGroup.Password.isValid() )
-## #info("$loginGroup.Password.Message" )
-## #end
+#set ( $loginGroup = $intake.Login.Default )
+
+#set ( $valid = true )
+#if (!$loginGroup.Username.isValid() )
+ ## this should be improved ...
+ #if ("$loginGroup.Username.Message" == "username_min_length_msg")
+ #info( $l10n.format("$loginGroup.Username.Message","4") )
+ #else
+ #info( $l10n.get("$loginGroup.Username.Message") )
+ #end
+ #set ( $valid = false )
+ #end
+
+ #if ( !$loginGroup.Password.isValid() )
+ #info( $l10n.get("$loginGroup.Password.Message") )
+ #set ( $valid = false )
+ #end
<p/>
#if (! $data.user.hasLoggedIn())
<div class="w3-display-middle w3-card-8 w3-center w3-light-grey"
style="max-width: 500px">
- <form class="w3-container w3-light-grey" name="login"
method="post"
action="$link.setAction("LoginUser").setPage($data.templateInfo.screenTemplate)">
+ <form class="w3-container w3-light-grey" name="login"
method="post" enctype="application/x-www-form-urlencoded"
action="$link.setAction("LoginUserIntake").setPage($data.templateInfo.screenTemplate)">
<div class="w3-section">
<p>
- <!-- input class="w3-input w3-border" style="margin:
auto; width: 200px;" placeholder="Username" type="text"
name="$loginGroup.Username.Key" value="$!loginGroup.Username" -->
+ <input class="w3-input w3-border" style="margin: auto;
width: 200px;" placeholder="Username" type="text"
name="$loginGroup.Username.Key" value="$!loginGroup.Username" tabindex="1"
autocomplete="off" autofocus="">
+ </p>
+
+ <p>
+ <input class="w3-input w3-border" style="margin: auto;
width: 200px;" placeholder="Password" type="password"
name="$loginGroup.Password.Key" value="" tabindex="2" autocomplete="off">
+ </p>
+
+ <button type="submit" name="submit" id="submit"
value="eventSubmit_doPerform" class="w3-ripple" tabindex="3">#if (! $valid )
Retry #else Sign in #end</button>
+
+ <p/>
+ ##$intake.declareGroups()
+
+ </div>
+ </form>
+
+ <!-- default login without Intake -->
+ <!--
+ <form class="w3-container w3-light-grey" name="login"
method="post"
action="$link.setAction("LoginUser").setPage($data.templateInfo.screenTemplate)">
+ <div class="w3-section">
+
+ <p>
<input class="w3-input w3-border" style="margin: auto;
width: 200px;" placeholder="Username" type="text" name="username" value=""
tabindex="1" autocomplete="off" autofocus="">
</p>
@@ -46,13 +74,16 @@
<input class="w3-input w3-border" style="margin: auto;
width: 200px;" placeholder="Password" type="password" name="password" value=""
tabindex="2" autocomplete="off">
</p>
- <button type="submit" name="submit" id="submit"
value="eventSubmit_doPerform" class="w3-ripple">Sign in</button>
+ <button type="submit" name="submit" id="submit"
value="eventSubmit_doPerform" class="w3-ripple" tabindex="3">Sign in</button>
<p/>
-
</div>
</form>
+
+
+
+ -->
<div class="w3-container w3-border-top w3-padding-16 w3-light-grey">