roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1617400 - in /roller/trunk/app/src/main: java/org/apache/roller/weblogger/ui/struts2/admin/ java/org/apache/roller/weblogger/ui/struts2/core/ resources/ resources/org/apache/roller/weblogger/ui/struts2/admin/ resources/org/apache/roller/we...
Date Tue, 12 Aug 2014 02:22:28 GMT
Author: gmazza
Date: Tue Aug 12 02:22:27 2014
New Revision: 1617400

URL: http://svn.apache.org/r1617400
Log:
More validation added in for OpenID auth; redundant validation files removed.

Added:
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/admin/UserEdit-validation.xml
Removed:
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/BookmarkAdd-validation.xml
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd-validation.xml
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd-validation.xml
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd-validation.xml
Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
    roller/trunk/app/src/main/resources/ApplicationResources.properties
    roller/trunk/app/src/main/resources/ApplicationResources_de.properties
    roller/trunk/app/src/main/resources/ApplicationResources_es.properties
    roller/trunk/app/src/main/resources/ApplicationResources_fr.properties
    roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties
    roller/trunk/app/src/main/resources/ApplicationResources_ko.properties
    roller/trunk/app/src/main/resources/ApplicationResources_ru.properties
    roller/trunk/app/src/main/resources/ApplicationResources_zh_CN.properties
    roller/trunk/app/src/main/webapp/WEB-INF/jsps/admin/UserEdit.jsp

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
Tue Aug 12 02:22:27 2014
@@ -38,6 +38,7 @@ import org.apache.roller.weblogger.pojos
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.core.Register;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
+import org.apache.struts2.interceptor.validation.SkipValidation;
 
 
 /**
@@ -99,6 +100,7 @@ public class UserEdit extends UIAction {
     /**
      * Show admin user edit page.
      */
+    @SkipValidation
     public String execute() {
         if (isAdd()) {
             // initial user create
@@ -114,6 +116,7 @@ public class UserEdit extends UIAction {
     /**
      * Post user created message after first save.
      */
+    @SkipValidation
     public String firstSave() {
         addMessage("createUser.add.success", getBean().getUserName());
         return execute();
@@ -190,7 +193,6 @@ public class UserEdit extends UIAction {
         return actionName.equals("createUser");
     }
 
-    // TODO: replace with struts2 validation
     private void myValidate() {
         if (isAdd()) {
             String allowed = WebloggerConfig.getProperty("username.allowedChars");
@@ -215,9 +217,6 @@ public class UserEdit extends UIAction {
                 addError("userAdmin.error.userNotFound");
             }
         }
-        if (StringUtils.isEmpty(getBean().getEmailAddress())) {
-            addError("error.add.user.missingEmailAddress");
-        }
     }
 
     public CreateUserBean getBean() {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
Tue Aug 12 02:22:27 2014
@@ -109,6 +109,14 @@ public class Profile extends UIAction {
     }
 
     public void myValidate() {
+        if (authMethod == AuthMethod.OPENID && StringUtils.isEmpty(getBean().getOpenIdUrl()))
{
+            addError("userRegister.error.missingOpenID");
+        }
+
+        if (authMethod == AuthMethod.DB_OPENID && StringUtils.isEmpty(getBean().getOpenIdUrl())
&& StringUtils.isEmpty(getBean().getPassword())) {
+            addError("userRegister.error.missingOpenIDOrPassword");
+        }
+
         // check that passwords match if they were specified (w/StringUtils.equals, null
== null)
         if (!StringUtils.equals(getBean().getPasswordText(), getBean().getPasswordConfirm()))
{
             addError("userRegister.error.mismatchedPasswords");

Modified: roller/trunk/app/src/main/resources/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources.properties Tue Aug 12 02:22:27
2014
@@ -1332,7 +1332,6 @@ userSettings.tip.username=Usernames can'
 # ----------------------------------------------------------------- Your profile (profile.jsp)
 
 yourProfile.title=Your Profile
-yourProfile.description=Change your password, default locale, timezone and other settings.
 
 # ------------------------------------------------------------------- User admin
 
@@ -1348,7 +1347,6 @@ userAdmin.subtitle.editUser=Editing prof
 userAdmin.title.createNewUser=Create new user
 userAdmin.subtitle.createNewUser=Creating user
 userAdmin.addInstructions=All fields are required.
-userAdmin.editInstructions=Fill in password field only if changing user''s password.
 
 userAdmin.enabled=Enabled
 userAdmin.title=User Administration
@@ -1370,7 +1368,8 @@ userAdmin.tip.fullName=User''s full name
 userAdmin.tip.userName=A short one-word username for the user account. \
 Please limit it to simple ASCII alphanumeric characters (a-z, A-Z and 0-9), \
 and do not use HTML.
-userAdmin.tip.password=User''s password.
+userAdmin.tip.openIdUrl=Open ID identifier (in the form of a URL).\
+userAdmin.tip.password=User''s password.  Fill in only to change it to what you enter.
 userAdmin.tip.email=Valid email address needed for automated notification.
 userAdmin.tip.enabled=Disabled users are unable to login to Roller.
 userAdmin.tip.userAdmin=Check to give user Global Admin rights on this Roller instance.
@@ -1424,7 +1423,7 @@ userRegister.tip.openid.only=This site u
 specify your OpenID identifier below. For more information about OpenID see \
 <a href=\"http://openid.net\">http://openid.net</a>.
 
-userRegister.tip.password=Your password.
+userRegister.tip.password=Your password.  Fill in only if you wish to change it.
 userRegister.tip.passwordConfirm=Confirm your password.
 userRegister.tip.openIdUrl=Your OpenID identifier (in the form of a URL).
 
@@ -1444,6 +1443,8 @@ userRegister.button.save=Sign Up
 
 userRegister.success.ready=Yes, form appears to be complete. Click the button below.
 userRegister.error.mismatchedPasswords=Your passwords do not match!
+userRegister.error.missingOpenID=Open ID URL must be provided.
+userRegister.error.missingOpenIDOrPassword=Either an Open ID URL or a password must be provided.
 
 # errors from validation
 Register.error.screenNameNull=Screen Name is a required field

Modified: roller/trunk/app/src/main/resources/ApplicationResources_de.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_de.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_de.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_de.properties Tue Aug 12 02:22:27
2014
@@ -698,7 +698,6 @@ userSettings.tip.username=Sie k\u00F6nne
 
 # ----------------------------------------------------- profile.jsp
 
-yourProfile.description=\u00C4ndern Sie Ihr Passwort, Ihren Ort, die Zeitzone und andere
Einstellungen.
 yourProfile.title=Ihr Profil
 
 # ----------------------------------------------------- create/modify.jsp

Modified: roller/trunk/app/src/main/resources/ApplicationResources_es.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_es.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_es.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_es.properties Tue Aug 12 02:22:27
2014
@@ -556,7 +556,6 @@ welcome.clickHere=Haga click aqu\u00ED
 welcome.toLoginAndPost=para entrar.
 yourProfile.title=Su perfil
 userSettings.tip.username=No puede cambiar nombre de usuario.
-yourProfile.description=Cambiar la contrase\u00F1a, lugar por defecto, zona horaria y otros
ajustes de configuraci\u00F3n.
 yourWebsites.title=Men\u00FA principal
 yourWebsites.actions=Acciones
 yourWebsites.createOne=crear uno?

Modified: roller/trunk/app/src/main/resources/ApplicationResources_fr.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_fr.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_fr.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_fr.properties Tue Aug 12 02:22:27
2014
@@ -1164,8 +1164,6 @@ welcome.toLoginAndPost=pour vous connect
 
 yourProfile.title=Votre profil
 userSettings.tip.username=Vous ne pouvez pas changer nom d'utilisateur.
-yourProfile.description=Vous pouvez changer votre mot de passe, votre langue par défaut
ou votre fuseau horaire, \
-ainsi que d'autres paramètres liés à votre profil.
 
 # ---------------------------------------------------------------- Your Weblogs
 

Modified: roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties Tue Aug 12 02:22:27
2014
@@ -904,7 +904,6 @@ welcome.toLoginAndPost=to login.
 # ----------------------------------------------------------------- Your profile
 
 yourProfile.title=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB
-yourProfile.description=\u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30ED\u30B1\u30FC\u30EB\u30FB\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\u306A\u3069\u304C\u5909\u66F4\u3067\u304D\u307E\u3059
 
 # ---------------------------------------------------------------- Your Weblogs
 

Modified: roller/trunk/app/src/main/resources/ApplicationResources_ko.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_ko.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_ko.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_ko.properties Tue Aug 12 02:22:27
2014
@@ -1287,7 +1287,6 @@ welcome.toLoginAndPost=
 # ----------------------------------------------------------------- Your profile
 
 yourProfile.title=\uadc0\ud558\uc758 \ud504\ub85c\ud30c\uc77c
-yourProfile.description=\ube44\ubc00\ubc88\ud638, \uae30\ubcf8 \ub85c\ucf00\uc77c, \uc2dc\uac04\ub300,
\uadf8\ub9ac\uace0 \uae30\ud0c0 \uc124\uc815 \uc815\ubcf4\ub4e4\uc744 \ubcc0\uacbd\ud558\uc2ed\uc2dc\uc624.
 
 # ---------------------------------------------------------------- Your Weblogs
 

Modified: roller/trunk/app/src/main/resources/ApplicationResources_ru.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_ru.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_ru.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_ru.properties Tue Aug 12 02:22:27
2014
@@ -866,7 +866,6 @@ welcome.toLoginAndPost = \u0410\u0432\u0
 # ----------------------------------------------------------------- Your profile
 
 yourProfile.title=\u0412\u0430\u0448 \u043f\u0440\u043e\u0444\u0438\u043b\u044c
-yourProfile.description=\u0418\u0437\u043c\u0435\u043d\u0438\u0435\u0442\u0435 \u0412\u0430\u0448
\u043f\u0430\u0440\u043e\u043b\u044c, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e
\u0437\u043e\u043d\u0443 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438.
 
 # ---------------------------------------------------------------- Your Weblogs
 

Modified: roller/trunk/app/src/main/resources/ApplicationResources_zh_CN.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_zh_CN.properties?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_zh_CN.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_zh_CN.properties Tue Aug 12 02:22:27
2014
@@ -581,7 +581,6 @@ welcome.accountCreated=\u606d\u559c\uff0
 welcome.clickHere=\u70b9\u51fb\u8fd9\u91cc
 welcome.title=\u6b22\u8fce\u6765\u5230 Roller\u4e16\u754c
 welcome.toLoginAndPost=\u767b\u5f55\u5e76\u64b0\u5199\u60a8\u7684\u7b2c\u4e00\u6761\u65e5\u5fd7\u5427!
-yourProfile.description=\u66f4\u6539\u60a8\u7684\u5bc6\u7801\u3001\u9ed8\u8ba4\u672c\u5730\u5316\u8bbe\u7f6e\u3001\u65f6\u533a\u548c\u5176\u4ed6\u8bbe\u7f6e\u3002
 yourProfile.title=\u60a8\u7684\u4e2a\u4eba\u8d44\u6599
 yourWebsites.accept=\u63a5\u53d7
 yourWebsites.actions=\u52a8\u4f5c

Added: roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/admin/UserEdit-validation.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/admin/UserEdit-validation.xml?rev=1617400&view=auto
==============================================================================
--- roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/admin/UserEdit-validation.xml
(added)
+++ roller/trunk/app/src/main/resources/org/apache/roller/weblogger/ui/struts2/admin/UserEdit-validation.xml
Tue Aug 12 02:22:27 2014
@@ -0,0 +1,65 @@
+<!DOCTYPE validators PUBLIC
+        "-//Apache Struts//XWork Validator 1.0.3//EN"
+        "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+    
+    <field name="bean.screenName">
+        <field-validator type="requiredstring">
+            <message key="Register.error.screenNameNull">unspecified key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">255</param>
+            <message key="Register.error.screenNameSize">unspecified key</message>
+        </field-validator>
+    </field>
+    
+    <field name="bean.fullName">
+        <field-validator type="requiredstring">
+            <message key="Register.error.fullNameNull">unspecified key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">255</param>
+            <message key="Register.error.fullNameSize">unspecified key</message>
+        </field-validator>
+    </field>
+    
+    <field name="bean.emailAddress">
+        <field-validator type="requiredstring">
+            <message key="Register.error.emailAddressNull">unspecified key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">255</param>
+            <message key="Register.error.emailAddressSize">unspecified key</message>
+        </field-validator>
+        
+        <field-validator type="email">
+            <message key="Register.error.emailAddressBad">unspecified key</message>
+        </field-validator>
+    </field>
+    
+    <field name="bean.locale">
+        <field-validator type="requiredstring">
+            <message key="Register.error.localeNull">unspecified key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">20</param>
+            <message key="Register.error.localeSize">unspecified key</message>
+        </field-validator>
+    </field>
+    
+    <field name="bean.timeZone">
+        <field-validator type="requiredstring">
+            <message key="Register.error.timeZoneNull">unspecified key</message>
+        </field-validator>
+        
+        <field-validator type="stringlength">
+            <param name="maxLength">20</param>
+            <message key="Register.error.timeZoneSize">unspecified key</message>
+        </field-validator>
+    </field>
+    
+</validators>

Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/admin/UserEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/admin/UserEdit.jsp?rev=1617400&r1=1617399&r2=1617400&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/admin/UserEdit.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/admin/UserEdit.jsp Tue Aug 12 02:22:27 2014
@@ -34,12 +34,9 @@
 </p>
 
 <p class="pagetip">
-    <s:if test="actionName == 'modifyUser'">
-        <s:text name="userAdmin.editInstructions"/>
-    </s:if>
-    <s:else>
+    <s:if test="actionName == 'createUser'">
         <s:text name="userAdmin.addInstructions"/>
-    </s:else>
+    </s:if>
 </p>
 
 <s:form>
@@ -94,7 +91,7 @@
             <tr>
                 <td class="label"><label for="openIdUrl" /><s:text name="userSettings.openIdUrl"
/></label></td>
                 <td class="field"><s:textfield name="bean.openIdUrl" size="40" maxlength="255"
style="width:75%" id="f_openid_identifier" /></td>
-                <td class="description"><s:text name="userRegister.tip.openIdUrl"
/></td>
+                <td class="description"><s:text name="userAdmin.tip.openIdUrl" /></td>
             </tr>
         </s:if>
 



Mime
View raw message