You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/12/29 23:33:55 UTC

cvs commit: jakarta-struts/src/example/org/apache/struts/example SaveRegistrationAction.java

craigmcc    00/12/29 14:33:54

  Modified:    src/example/org/apache/struts/example
                        SaveRegistrationAction.java
  Log:
  Correct a logic error introduced when we switched to PropertyUtils.  Do not
  replace the password (with a blank string) unless the user specified a new
  password for both the "password" and "password2" fields, and they matched.
  
  Revision  Changes    Path
  1.12      +8 -4      jakarta-struts/src/example/org/apache/struts/example/SaveRegistrationAction.java
  
  Index: SaveRegistrationAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/example/org/apache/struts/example/SaveRegistrationAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SaveRegistrationAction.java	2000/10/16 16:50:04	1.11
  +++ SaveRegistrationAction.java	2000/12/29 22:33:54	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/example/org/apache/struts/example/SaveRegistrationAction.java,v 1.11 2000/10/16 16:50:04 craigmcc Exp $
  - * $Revision: 1.11 $
  - * $Date: 2000/10/16 16:50:04 $
  + * $Header: /home/cvs/jakarta-struts/src/example/org/apache/struts/example/SaveRegistrationAction.java,v 1.12 2000/12/29 22:33:54 craigmcc Exp $
  + * $Revision: 1.12 $
  + * $Date: 2000/12/29 22:33:54 $
    *
    * ====================================================================
    *
  @@ -89,7 +89,7 @@
    * registration is created, the user is also implicitly logged on.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.11 $ $Date: 2000/10/16 16:50:04 $
  + * @version $Revision: 1.12 $ $Date: 2000/12/29 22:33:54 $
    */
   
   public final class SaveRegistrationAction extends Action {
  @@ -187,7 +187,11 @@
   	    user.setUsername(regform.getUsername());
   	}
           try {
  +            String oldPassword = user.getPassword();
               PropertyUtils.copyProperties(user, regform);
  +            if ((regform.getPassword() == null) ||
  +                (regform.getPassword().length() < 1))
  +                user.setPassword(oldPassword);
           } catch (InvocationTargetException e) {
               Throwable t = e.getTargetException();
               if (t == null)