You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2001/07/03 19:17:28 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions CreateNewUserAndConfirm.java JLoginUser.java SendConfirmationEmail.java

taylor      01/07/03 10:17:28

  Modified:    src/java/org/apache/jetspeed/modules/actions
                        CreateNewUserAndConfirm.java JLoginUser.java
                        SendConfirmationEmail.java
  Log:
  - fixed bug with creating new user accounts with email option enabled.
  - removed all references to .vm so that .jsp templates can be properly used (thanks to Chris Kimpton)
  
  Revision  Changes    Path
  1.20      +13 -9     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/CreateNewUserAndConfirm.java
  
  Index: CreateNewUserAndConfirm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/CreateNewUserAndConfirm.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CreateNewUserAndConfirm.java	2001/07/02 07:33:38	1.19
  +++ CreateNewUserAndConfirm.java	2001/07/03 17:17:14	1.20
  @@ -85,6 +85,7 @@
   
   // security
   import org.apache.jetspeed.services.JetspeedSecurity;
  +import org.apache.turbine.services.security.TurbineSecurity;
   import org.apache.turbine.util.security.AccessControlList;
   
   /**
  @@ -124,7 +125,7 @@
               || ! pass1.equals ( pass2 ) )
           {
               data.setMessage(Localization.getString("CREATENEWUSERANDCONFIRM_PWNOTMATCH"));
  -            data.setScreenTemplate("NewAccount.vm");
  +            data.setScreenTemplate("NewAccount");
               return;
           }
           
  @@ -133,7 +134,7 @@
           if ( username.length() == 0 )
           {
               data.setMessage(Localization.getString("CREATENEWUSERANDCONFIRM_NOUSERNAME"));
  -            data.setScreenTemplate("NewAccount.vm");
  +            data.setScreenTemplate("NewAccount");
               return;
           }            
           String email = data.getParameters().getString("email", "");
  @@ -141,7 +142,7 @@
           if ( email.length() == 0 )
           {
               data.setMessage(Localization.getString("CREATENEWUSERANDCONFIRM_NOEMAIL"));
  -            data.setScreenTemplate("NewAccount.vm");
  +            data.setScreenTemplate("NewAccount");
               return;
           }
   
  @@ -182,8 +183,11 @@
                   data.setMessage(Localization.getString("CREATENEWUSERANDCONFIRM_CREATE"));
                   if (enableMail)
                   {
  +                    data.setUser(TurbineSecurity.getAnonymousUser());
  +                    data.getParameters().add("username", username);
  +                    data.getParameters().add("password", pass1);
                       ActionLoader.getInstance().exec(data, "SendConfirmationEmail");
  -                    data.setScreenTemplate("ConfirmRegistration.vm");
  +                    data.setScreenTemplate("ConfirmRegistration");
                   }
                   else
                   {
  @@ -194,7 +198,7 @@
               else // username exists. show the screen again.
               {
                   data.setMessage(Localization.getString("CREATENEWUSERANDCONFIRM_CHOOSENEWNAME"));
  -                data.setScreenTemplate("NewAccount.vm");
  +                data.setScreenTemplate("NewAccount");
                   // set the username to be the CHNAME string so that it is 
                   // clear that this needs to be replaced
                   data.getParameters().add("username", CHNAME);
  @@ -204,7 +208,7 @@
           {
             data.setMessage(e.toString());
             data.setStackTrace(StringUtils.stackTrace(e), e);
  -          data.setScreenTemplate("Error.vm");
  +          data.setScreenTemplate("Error");
           }
       }
   
  @@ -245,9 +249,9 @@
   
             // bring logged on user to homepage with internal redirect
             //data.setScreenTemplate(TurbineTemplate.getDefaultScreen());
  -          //data.setScreenTemplate("Home.vm");
  +          //data.setScreenTemplate("Home");
             DynamicURI duri = new DynamicURI (data);
  -          duri.addPathInfo(JetspeedResources.PATH_TEMPLATE_KEY, "Home.vm");
  +          duri.addPathInfo(JetspeedResources.PATH_TEMPLATE_KEY, "Home");
             data.getResponse().sendRedirect(duri.toString());
   
           }
  @@ -255,7 +259,7 @@
           {
               data.setMessage(e.toString());
               data.setStackTrace(StringUtils.stackTrace(e), e);
  -            data.setScreenTemplate("Error.vm");
  +            data.setScreenTemplate("Error");
           }
         }
   
  
  
  
  1.15      +8 -2      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JLoginUser.java
  
  Index: JLoginUser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JLoginUser.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JLoginUser.java	2001/06/28 08:49:41	1.14
  +++ JLoginUser.java	2001/07/03 17:17:17	1.15
  @@ -116,10 +116,16 @@
               
               // check to make sure the user entered the right confirmation key
               // if not, then send them to the ConfirmRegistration screen            
  -            User user = data.getUser();           
  +//            User user = data.getUser();          
  +            String username = data.getParameters().getString("username", "");
  +            String password = data.getParameters().getString("password", "");
  +            User user = JetspeedSecurity.getUser(username);
  +
               if (user == null)
  +            {
  +                Log.error("JLogin User: Unexpected condition : user is NULL");
                   return;   
  -
  +            }
               String confirm_value = user.getConfirmed();
               if ( ! secretkey.equals ( confirm_value ) && ! confirm_value.equals ( JetspeedResources.CONFIRM_VALUE ) )
               {
  
  
  
  1.11      +7 -13     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/SendConfirmationEmail.java
  
  Index: SendConfirmationEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/SendConfirmationEmail.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SendConfirmationEmail.java	2001/06/22 06:35:53	1.10
  +++ SendConfirmationEmail.java	2001/07/03 17:17:19	1.11
  @@ -67,6 +67,7 @@
   import org.apache.turbine.util.mail.Email;
   import org.apache.turbine.util.db.Criteria;
   import org.apache.turbine.util.Log;
  +import org.apache.jetspeed.services.JetspeedSecurity;
   
   /**
       This action will attempt to send a confirmation email to the user.
  @@ -80,29 +81,22 @@
   {
       public void doPerform( RunData data ) throws Exception
       {
  -        String username = null;
  -        User user = data.getUser();
  +        String username = data.getParameters().getString("username", "");
  +        String password  = data.getParameters().getString("password", "");
           
  -        if ( user.hasLoggedIn() )
  -        {
  -            username = (String) user.getUserName();
  -        }
  -        else
  -        {
  -            username = data.getParameters().getString("username", "");
  -        }
  +        User user = JetspeedSecurity.getUser(username);        
   
           String email = data.getParameters().getString("email", "");
           String firstname = data.getParameters().getString("firstname", "");
           String lastname = data.getParameters().getString("lastname", "");
           String nextscreen = data.getParameters().getString("nextscreen", "");
  -//        String secretkey = (String)user.getPerm(User.CONFIRM_VALUE);
           String secretkey = user.getConfirmed();
           
  -        DynamicURI url = new DynamicURI(data, "ConfirmRegistration")
  +        DynamicURI url = new DynamicURI(data)
  +            .addPathInfo(JetspeedResources.PATH_TEMPLATE_KEY, "ConfirmRegistration")
               .addPathInfo("username", username )
               .addPathInfo("secretkey", secretkey)
  -            .addPathInfo("nextscreen", nextscreen );
  +            .addPathInfo("password", password );
           
           String email_body = Localization.getString("SENDCONFIRMATIONEMAIL_BODY1") +
           secretkey + "\n\n" + Localization.getString("SENDCONFIRMATIONEMAIL_BODY2") +
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org