maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r440869 - in /maven/shared/trunk/maven-user: maven-user-controller/src/main/java/org/apache/maven/user/controller/action/EditUserAction.java maven-user-webapp/src/main/webapp/user/edit.jsp
Date Wed, 06 Sep 2006 21:08:13 GMT
Author: carlos
Date: Wed Sep  6 14:08:12 2006
New Revision: 440869

URL: http://svn.apache.org/viewvc?view=rev&rev=440869
Log:
Add confirmpassword field, don't allow editing username

Modified:
    maven/shared/trunk/maven-user/maven-user-controller/src/main/java/org/apache/maven/user/controller/action/EditUserAction.java
    maven/shared/trunk/maven-user/maven-user-webapp/src/main/webapp/user/edit.jsp

Modified: maven/shared/trunk/maven-user/maven-user-controller/src/main/java/org/apache/maven/user/controller/action/EditUserAction.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-user/maven-user-controller/src/main/java/org/apache/maven/user/controller/action/EditUserAction.java?view=diff&rev=440869&r1=440868&r2=440869
==============================================================================
--- maven/shared/trunk/maven-user/maven-user-controller/src/main/java/org/apache/maven/user/controller/action/EditUserAction.java
(original)
+++ maven/shared/trunk/maven-user/maven-user-controller/src/main/java/org/apache/maven/user/controller/action/EditUserAction.java
Wed Sep  6 14:08:12 2006
@@ -27,6 +27,7 @@
 import org.apache.maven.user.model.User;
 import org.apache.maven.user.model.UserGroup;
 import org.apache.maven.user.model.UserManager;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.xwork.action.PlexusActionSupport;
 
 import com.opensymphony.webwork.interceptor.ServletRequestAware;
@@ -72,6 +73,8 @@
 
     private String password;
 
+    private String confirmPassword;
+
     private String email;
 
     private List permissions;
@@ -94,6 +97,11 @@
         {
             email = email.substring( 0, email.indexOf( "," ) );
         }
+        if( !StringUtils.isEmpty( password ) && !password.equals( confirmPassword
) )
+        {
+        	addActionError( "user.password.mismatch.error" );
+        	return INPUT;
+        }
         if ( addMode )
         {
             userGroup = new UserGroup();
@@ -325,6 +333,14 @@
     {
         this.password = password;
     }
+
+	public String getConfirmPassword() {
+		return confirmPassword;
+	}
+
+	public void setConfirmPassword(String confirmPassword) {
+		this.confirmPassword = confirmPassword;
+	}
 
     public String getEmail()
     {

Modified: maven/shared/trunk/maven-user/maven-user-webapp/src/main/webapp/user/edit.jsp
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-user/maven-user-webapp/src/main/webapp/user/edit.jsp?view=diff&rev=440869&r1=440868&r2=440869
==============================================================================
--- maven/shared/trunk/maven-user/maven-user-webapp/src/main/webapp/user/edit.jsp (original)
+++ maven/shared/trunk/maven-user/maven-user-webapp/src/main/webapp/user/edit.jsp Wed Sep
 6 14:08:12 2006
@@ -7,18 +7,21 @@
     var accountId_field = document.getElementById('accountId_field');
     var username_field = document.getElementById('username_field');
     var password_field = document.getElementById('password_field');
+    var confirm_password_field = document.getElementById('confirm_password_field');
     var email_field = document.getElementById('email_field');
 
     var addMode = document.getElementById('addMode');
     var accountId = document.getElementById('accountId');
     var username = document.getElementById('username');
     var password = document.getElementById('password');
+    var confirmPassword = document.getElementById('confirmPassword');
     var email = document.getElementById('email');
 
     addMode.value = addMode_field.value;
     accountId.value = accountId_field.value;
     username.value = username_field.value;
     password.value = password_field.value;
+    confirmPassword.value = confirm_password_field.value;
     email.value = email_field.value;
   }
 </script>
@@ -45,7 +48,7 @@
             <c:if test="${!empty actionErrors}">
               <div class="errormessage">
               <c:forEach items="${actionErrors}" var="actionError">
-                <p>${actionError}</p>
+                <p><ww:text name="${actionError}"/></p>
               </c:forEach>
               </div>
             </c:if>
@@ -53,8 +56,15 @@
               <tbody>
                 <ww:hidden id="addMode_field" name="addMode"/>
                 <ww:hidden id="accountId_field" name="accountId"/>
-                <ww:textfield id="username_field" label="%{getText('user.username')}"
name="username" required="true"/>
+                <ww:if test="addMode == true">
+                  <ww:textfield id="username_field" label="%{getText('user.username')}"
name="username" required="true"/>
+                </ww:if>
+                <ww:else>
+                  <ww:hidden id="username_field" name="username"/>
+                  <ww:textfield id="username_field" label="%{getText('user.username')}"
name="username" required="true" disabled="true"/>
+                </ww:else>
                 <ww:password id="password_field" label="%{getText('user.password')}" name="password"
required="true"/>
+                <ww:password id="confirm_password_field" label="%{getText('user.confirm.password')}"
name="confirmPassword" required="true"/>
                 <ww:textfield id="email_field" label="%{getText('user.email')}" name="email"
required="true"/>
               </tbody>
             </table>
@@ -62,6 +72,7 @@
               <ww:submit value="%{getText('save')}"/> <!-- todo: change to submit/cancel
button -->
             </div>
           </ww:form>
+        <ww:if test="addMode == false">
           <div id="h3">
             <h3><ww:text name="role.section.title"/></h3>
             <ww:set name="permissions" value="permissions" scope="session"/>
@@ -98,6 +109,7 @@
               <ww:submit onclick="getData()" value="%{getText('add')}"/>
             </ww:form>
           </div>
+        </ww:if>
         </div>
       </div>
     </body>



Mime
View raw message