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 jf...@apache.org on 2004/08/30 00:31:49 UTC

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

jford       2004/08/29 15:31:49

  Modified:    src/java/org/apache/jetspeed/modules/actions
                        UpdateAccount.java JLoginUser.java
                        ChangePassword.java
                        SendNewUserNotificationEmail.java
                        CreateNewUserAndConfirm.java
                        SendConfirmationEmail.java
  Log:
  Switch from Turbine's Localization service to Jetspeed's CustomLocalization service
  
  PR: JIRA #JS1-396
  
  Revision  Changes    Path
  1.24      +7 -7      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/UpdateAccount.java
  
  Index: UpdateAccount.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/UpdateAccount.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- UpdateAccount.java	3 Jun 2004 01:22:10 -0000	1.23
  +++ UpdateAccount.java	29 Aug 2004 22:31:49 -0000	1.24
  @@ -22,6 +22,7 @@
   import javax.servlet.http.Cookie;
   
   // Jetspeed
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.resources.JetspeedResources;
   import org.apache.jetspeed.services.JetspeedSecurity;
   import org.apache.jetspeed.services.security.JetspeedSecurityException;
  @@ -30,7 +31,6 @@
   // Turbine
   import org.apache.turbine.modules.Action;
   import org.apache.turbine.modules.ActionLoader;
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.GenerateUniqueId;
   
  @@ -93,7 +93,7 @@
           
           if ( changepass == true && ! password.equals( password2 ) )
           {
  -            data.setMessage(Localization.getString(rundata, "UPDATEACCOUNT_PWNOTMATCH"));
  +            data.setMessage(CustomLocalization.getString("UPDATEACCOUNT_PWNOTMATCH", rundata));
               backToEditAccount( data, screenData );
               return;
           }
  @@ -109,7 +109,7 @@
           // make sure the firstname exists
           if ( firstname.length() == 0 )
           {
  -            data.setMessage(Localization.getString(rundata, "UPDATEACCOUNT_NOFIRSTNAME"));
  +            data.setMessage(CustomLocalization.getString("UPDATEACCOUNT_NOFIRSTNAME", rundata));
               backToEditAccount( data, screenData );
               return;
           }
  @@ -119,7 +119,7 @@
           // make sure the lastname exists
           if ( lastname.length() == 0 )
           {
  -            data.setMessage(Localization.getString(rundata, "UPDATEACCOUNT_NOLASTNAME"));
  +            data.setMessage(CustomLocalization.getString("UPDATEACCOUNT_NOLASTNAME", rundata));
               backToEditAccount( data, screenData );
               return;
           }
  @@ -218,7 +218,7 @@
           // make sure the email exists
           if ( email.length() == 0 )
           {
  -            data.setMessage(Localization.getString(rundata, "UPDATEACCOUNT_NOEMAIL"));
  +            data.setMessage(CustomLocalization.getString("UPDATEACCOUNT_NOEMAIL", rundata));
               backToEditAccount( data, screenData );
               return;
           }
  @@ -235,7 +235,7 @@
                   ActionLoader.getInstance().exec(data, "SendConfirmationEmail");
                   // add in the username to the parameters because ConfirmRegistration needs it
                   data.getParameters().add("username", data.getUser().getUserName() );
  -                data.setMessage(Localization.getString(rundata, "UPDATEACCOUNT_NEWEMAILCONFIRM"));
  +                data.setMessage(CustomLocalization.getString("UPDATEACCOUNT_NEWEMAILCONFIRM", rundata));
                   data.setScreenTemplate("ConfirmRegistration");
               }
           else
  @@ -264,7 +264,7 @@
           updateUser(data);
   
           JetspeedSecurity.saveUser( data.getJetspeedUser() );
  -        data.setMessage (Localization.getString(rundata, "UPDATEACCOUNT_DONE"));
  +        data.setMessage (CustomLocalization.getString("UPDATEACCOUNT_DONE", rundata));
           
       }
   
  
  
  
  1.41      +17 -17    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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- JLoginUser.java	30 Apr 2004 23:34:27 -0000	1.40
  +++ JLoginUser.java	29 Aug 2004 22:31:49 -0000	1.41
  @@ -28,7 +28,6 @@
   import org.apache.velocity.context.Context;
   import org.apache.turbine.TurbineConstants;
   import org.apache.turbine.modules.ActionEvent;
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.services.velocity.TurbineVelocity;
   import org.apache.turbine.services.template.TurbineTemplate;
   import org.apache.turbine.util.mail.SimpleEmail;
  @@ -38,6 +37,7 @@
   // Jetspeed modules
   import org.apache.jetspeed.services.TemplateLocator;
   import org.apache.jetspeed.om.security.JetspeedUser;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.security.nosecurity.FakeJetspeedUser;
  @@ -88,9 +88,9 @@
               if (user == null)
               {
                   data.setScreenTemplate("LoginHelp");
  -                data.setMessage(Localization.getString("JLOGINUSER_PASSWORDREMINDER_INVALIDUSER"));
  +                data.setMessage(CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_INVALIDUSER", rundata));
                   if (logger.isDebugEnabled())
  -                    logger.debug(Localization.getString(rundata, "JLOGINUSER_PASSWORDREMINDER_INVALIDUSER"));
  +                    logger.debug(CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_INVALIDUSER", rundata));
                   return;
               }
   
  @@ -134,13 +134,13 @@
   
               se.send();
   
  -            data.setMessage (Localization.getString(rundata, "JLOGINUSER_PASSWORDREMINDER_SENT"));
  +            data.setMessage (CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_SENT", rundata));
               logger.info( "Password for user " + user.getUserName() + " was sent to " + user.getEmail());
  -            logger.info(Localization.getString(rundata, "JLOGINUSER_PASSWORDREMINDER_SENT"));
  +            logger.info(CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_SENT", rundata));
               data.setScreenTemplate("Login");
           } catch ( Exception e ) {
               data.setScreenTemplate("LoginHelp");
  -            String errorTitle = Localization.getString(rundata, "JLOGINUSER_PASSWORDREMINDER_ERROR") ;
  +            String errorTitle = CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_ERROR", rundata) ;
               String errorMessage = errorTitle + e.toString();
   
               logger.warn( errorMessage, e );
  @@ -185,7 +185,7 @@
               {
                   if ( newUserApproval )
                   {
  -                    data.setMessage(Localization.getString(rundata, "JLOGINUSER_KEYNOTVALID"));
  +                    data.setMessage(CustomLocalization.getString("JLOGINUSER_KEYNOTVALID", rundata));
                       data.setScreenTemplate("NewUserAwaitingAcceptance");
                       return;
                   }
  @@ -193,13 +193,13 @@
                   {
                     if ( user.getConfirmed().equals(JetspeedResources.CONFIRM_VALUE_REJECTED))
                     {
  -                    data.setMessage(Localization.getString(rundata, "JLOGINUSER_KEYNOTVALID"));
  +                    data.setMessage(CustomLocalization.getString("JLOGINUSER_KEYNOTVALID", rundata));
                       data.setScreenTemplate("NewUserRejected");
                       return;
                     }
                     else
                     {
  -                    data.setMessage(Localization.getString(rundata, "JLOGINUSER_KEYNOTVALID"));
  +                    data.setMessage(CustomLocalization.getString("JLOGINUSER_KEYNOTVALID", rundata));
                       data.setScreenTemplate("ConfirmRegistration");
                       return;
                     }
  @@ -207,7 +207,7 @@
               }
                
               user.setConfirmed( JetspeedResources.CONFIRM_VALUE );
  -            data.setMessage (Localization.getString(rundata, "JLOGINUSER_WELCOME"));
  +            data.setMessage (CustomLocalization.getString("JLOGINUSER_WELCOME", rundata));
               JetspeedSecurity.saveUser(user);
           }
           
  @@ -230,7 +230,7 @@
                   if (!disableCheck(data))
                   {                
                       logger.info("JLoginUser: Credential Failure on login for user: " + username);
  -                    data.setMessage(Localization.getString(rundata, "PASSWORDFORM_FAILED_MSG"));
  +                    data.setMessage(CustomLocalization.getString("PASSWORDFORM_FAILED_MSG", rundata));
                   }
               }
               else if (e instanceof AccountExpiredException)
  @@ -243,7 +243,7 @@
                   data.setScreenTemplate(
                       JetspeedResources.getString(JetspeedResources.CHANGE_PASSWORD_TEMPLATE, "ChangePassword")
                       );
  -                data.setMessage(Localization.getString(rundata, "PASSWORDFORM_EXPIRED_MSG"));
  +                data.setMessage(CustomLocalization.getString("PASSWORDFORM_EXPIRED_MSG", rundata));
                   data.getParameters().setString("username", username);
               } 
   
  @@ -261,7 +261,7 @@
           }
           if (user.getDisabled())
           {
  -            data.setMessage(Localization.getString(rundata, "JLOGINUSER_ACCOUNT_DISABLED"));
  +            data.setMessage(CustomLocalization.getString("JLOGINUSER_ACCOUNT_DISABLED", rundata));
               data.setScreenTemplate(JetspeedResources.getString("logon.disabled.form"));
               data.getUser().setHasLoggedIn(new Boolean (false) );
               data.setUser(JetspeedSecurity.getAnonymousUser());            
  @@ -282,14 +282,14 @@
               {
                   if (confirmed != null && confirmed.equals(JetspeedResources.CONFIRM_VALUE_REJECTED))
                   {
  -                  data.setMessage(Localization.getString(rundata, "JLOGINUSER_KEYNOTVALID"));
  +                  data.setMessage(CustomLocalization.getString("JLOGINUSER_KEYNOTVALID", rundata));
                     data.setScreenTemplate("NewUserRejected");
                     data.getUser().setHasLoggedIn(new Boolean (false) );
                     return;
                   }
                   else
                   {
  -                  data.setMessage(Localization.getString(rundata, "JLOGINUSER_CONFIRMFIRST"));
  +                  data.setMessage(CustomLocalization.getString("JLOGINUSER_CONFIRMFIRST", rundata));
                     data.setScreenTemplate("ConfirmRegistration");
                     data.getUser().setHasLoggedIn(new Boolean (false) );
                     return;
  @@ -374,7 +374,7 @@
               
               if (disabled)
               {
  -                data.setMessage(Localization.getString(data, "JLOGINUSER_ACCOUNT_DISABLED"));
  +                data.setMessage(CustomLocalization.getString("JLOGINUSER_ACCOUNT_DISABLED", data));
                   data.setScreenTemplate(JetspeedResources.getString("logon.disabled.form"));
                   data.getUser().setHasLoggedIn(new Boolean (false) );
                   data.setUser(JetspeedSecurity.getAnonymousUser());                
  
  
  
  1.8       +7 -7      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/ChangePassword.java
  
  Index: ChangePassword.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/ChangePassword.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ChangePassword.java	23 Feb 2004 02:59:06 -0000	1.7
  +++ ChangePassword.java	29 Aug 2004 22:31:49 -0000	1.8
  @@ -18,6 +18,7 @@
   
   // Jetspeed
   import org.apache.jetspeed.services.JetspeedSecurity;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.resources.JetspeedResources;
  @@ -28,7 +29,6 @@
   // Turbine
   import org.apache.turbine.modules.Action;
   import org.apache.turbine.modules.ActionLoader;
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.TurbineConstants;
   
  @@ -49,7 +49,7 @@
       public void doPerform(RunData rundata) throws Exception
       {
   
  -        String cancelBtn = rundata.getParameters().getString(Localization.getString(rundata, "PASSWORDFORM_CANCEL"));
  +        String cancelBtn = rundata.getParameters().getString(CustomLocalization.getString("PASSWORDFORM_CANCEL", rundata));
           String username  = rundata.getParameters().getString("username" , "");
           String oldPassword  = JetspeedSecurity.convertPassword(rundata.getParameters().getString("old_password" , ""));
           String password  = JetspeedSecurity.convertPassword(rundata.getParameters().getString("password", ""));
  @@ -59,7 +59,7 @@
           //
           // check to see if the Cancel button was pressed.
           // if so, return to default portal page
  -        if (cancelBtn != null && cancelBtn.equalsIgnoreCase(Localization.getString(rundata, "PASSWORDFORM_CANCEL")))
  +        if (cancelBtn != null && cancelBtn.equalsIgnoreCase(CustomLocalization.getString("PASSWORDFORM_CANCEL", rundata)))
           {
               return;
           }
  @@ -73,21 +73,21 @@
   
               if (!password.equals(password2))
               {
  -                rundata.setMessage(Localization.getString(rundata, "UPDATEACCOUNT_PWNOTMATCH"));
  +                rundata.setMessage(CustomLocalization.getString("UPDATEACCOUNT_PWNOTMATCH", rundata));
                   rundata.setScreenTemplate(returnTemplate);
                   return;
               }
   
               if (password.equals(oldPassword))
               {
  -                rundata.setMessage(Localization.getString(rundata, "PASSWORDFORM_THESAME_MSG"));
  +                rundata.setMessage(CustomLocalization.getString("PASSWORDFORM_THESAME_MSG", rundata));
                   rundata.setScreenTemplate(returnTemplate);
                   return;
               }
   
               // Change the password
               JetspeedSecurity.changePassword(user, oldPassword, password);
  -            rundata.setMessage(Localization.getString(rundata, "PASSWORDFORM_DONE"));
  +            rundata.setMessage(CustomLocalization.getString("PASSWORDFORM_DONE", rundata));
   
               // Login again
               rundata.getParameters().setString("username", username);
  
  
  
  1.6       +3 -3      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/SendNewUserNotificationEmail.java
  
  Index: SendNewUserNotificationEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/SendNewUserNotificationEmail.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SendNewUserNotificationEmail.java	23 Feb 2004 02:59:06 -0000	1.5
  +++ SendNewUserNotificationEmail.java	29 Aug 2004 22:31:49 -0000	1.6
  @@ -25,13 +25,13 @@
   import org.apache.jetspeed.services.resources.JetspeedResources;
   import org.apache.jetspeed.services.TemplateLocator;
   import org.apache.jetspeed.services.JetspeedSecurity;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.om.security.JetspeedUser;
   
   // Turbine Stuff
   import org.apache.turbine.modules.Action;
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.services.velocity.TurbineVelocity;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.DynamicURI;
  @@ -95,10 +95,10 @@
   
               se.send();
   
  -            data.setMessage (Localization.getString(data, "SENDCONFIRMATIONEMAIL_SENT"));
  +            data.setMessage (CustomLocalization.getString("SENDCONFIRMATIONEMAIL_SENT", data));
           } catch ( Exception e )
           {
  -            String errorTitle = Localization.getString(data, "SENDCONFIRMATIONEMAIL_ERROR") ;
  +            String errorTitle = CustomLocalization.getString("SENDCONFIRMATIONEMAIL_ERROR", data) ;
               String errorMessage = errorTitle + e.getMessage();
   
               logger.error( errorMessage, e );
  
  
  
  1.39      +7 -7      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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- CreateNewUserAndConfirm.java	23 Feb 2004 02:59:06 -0000	1.38
  +++ CreateNewUserAndConfirm.java	29 Aug 2004 22:31:49 -0000	1.39
  @@ -23,6 +23,7 @@
   import org.apache.jetspeed.om.security.JetspeedUser;
   
   // Jetspeed modules
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.util.template.JetspeedLink;
  @@ -33,7 +34,6 @@
   import org.apache.turbine.modules.ActionLoader;
   
   // resources
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.jetspeed.services.resources.JetspeedResources;
   
   // templates
  @@ -93,7 +93,7 @@
               if ( (pass1.length() == 0 || pass2.length() == 0 )
                   || ! pass1.equals ( pass2 ) )
               {
  -                data.setMessage(Localization.getString(data, "CREATENEWUSERANDCONFIRM_PWNOTMATCH"));
  +                data.setMessage(CustomLocalization.getString("CREATENEWUSERANDCONFIRM_PWNOTMATCH", data));
                   data.setScreenTemplate("NewAccount");
                   return;
               }
  @@ -108,7 +108,7 @@
               // make sure the username exists
               if ( username.length() == 0 )
               {
  -                data.setMessage(Localization.getString(data, "CREATENEWUSERANDCONFIRM_NOUSERNAME"));
  +                data.setMessage(CustomLocalization.getString("CREATENEWUSERANDCONFIRM_NOUSERNAME", data));
                   data.setScreenTemplate("NewAccount");
                   return;
               }
  @@ -117,12 +117,12 @@
               // make sure the email exists
               if ( email.length() == 0 )
               {
  -                data.setMessage(Localization.getString(data, "CREATENEWUSERANDCONFIRM_NOEMAIL"));
  +                data.setMessage(CustomLocalization.getString("CREATENEWUSERANDCONFIRM_NOEMAIL", data));
                   data.setScreenTemplate("NewAccount");
                   return;
               }
   
  -            String CHNAME = Localization.getString(data, "CREATENEWUSERANDCONFIRM_DUPLICATEMSG");
  +            String CHNAME = CustomLocalization.getString("CREATENEWUSERANDCONFIRM_DUPLICATEMSG", data);
   
               boolean accountExists = true;
               try
  @@ -174,7 +174,7 @@
                     user.setHasLoggedIn(new Boolean (true));
                     user.setLastLogin(new Date(0));
                   }
  -                data.setMessage(Localization.getString(data, "CREATENEWUSERANDCONFIRM_CREATE"));
  +                data.setMessage(CustomLocalization.getString("CREATENEWUSERANDCONFIRM_CREATE", data));
                   if (enableMail || newUserNotification || newUserApproval)
                   {
                       data.setUser(JetspeedSecurity.getAnonymousUser());
  @@ -204,7 +204,7 @@
               }
               else // username exists. show the screen again.
               {
  -                data.setMessage(Localization.getString(data, "CREATENEWUSERANDCONFIRM_CHOOSENEWNAME"));
  +                data.setMessage(CustomLocalization.getString("CREATENEWUSERANDCONFIRM_CHOOSENEWNAME", data));
                   data.setScreenTemplate("NewAccount");
                   // set the username to be the CHNAME string so that it is
                   // clear that this needs to be replaced
  
  
  
  1.20      +3 -3      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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SendConfirmationEmail.java	23 Feb 2004 02:59:06 -0000	1.19
  +++ SendConfirmationEmail.java	29 Aug 2004 22:31:49 -0000	1.20
  @@ -22,6 +22,7 @@
     
   // Jetspeed Stuff
   import org.apache.jetspeed.services.TemplateLocator;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.resources.JetspeedResources;
  @@ -30,7 +31,6 @@
   
   // Turbine Stuff
   import org.apache.turbine.modules.Action;
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.services.velocity.TurbineVelocity;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.DynamicURI;
  @@ -89,11 +89,11 @@
   
               se.send();
   
  -            data.setMessage (Localization.getString(data, "SENDCONFIRMATIONEMAIL_SENT"));
  +            data.setMessage (CustomLocalization.getString("SENDCONFIRMATIONEMAIL_SENT", data));
           }
           catch ( Exception e )
           {
  -            String errorTitle = Localization.getString("SENDCONFIRMATIONEMAIL_ERROR") ;
  +            String errorTitle = CustomLocalization.getString("SENDCONFIRMATIONEMAIL_ERROR", data) ;
               String errorMessage = errorTitle + e.getMessage();
   
               logger.error( errorMessage, e );
  
  
  

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