[Yanel-commits] rev 44487 - public/yanel/trunk/src/contributions/resources/forgotpw/src/java/org/wyona/yanel/impl/resources/forgotpw

michi at wyona.com michi at wyona.com
Mon Aug 31 10:49:50 CEST 2009


Author: michi
Date: 2009-08-31 10:49:50 +0200 (Mon, 31 Aug 2009)
New Revision: 44487

Modified:
   public/yanel/trunk/src/contributions/resources/forgotpw/src/java/org/wyona/yanel/impl/resources/forgotpw/ForgotPassword.java
Log:
note about how long the link will be available added

Modified: public/yanel/trunk/src/contributions/resources/forgotpw/src/java/org/wyona/yanel/impl/resources/forgotpw/ForgotPassword.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/forgotpw/src/java/org/wyona/yanel/impl/resources/forgotpw/ForgotPassword.java	2009-08-31 08:38:00 UTC (rev 44486)
+++ public/yanel/trunk/src/contributions/resources/forgotpw/src/java/org/wyona/yanel/impl/resources/forgotpw/ForgotPassword.java	2009-08-31 08:49:50 UTC (rev 44487)
@@ -73,6 +73,8 @@
 
     private static final String SMTP_HOST_PROPERTY_NAME = "smtpHost";
 
+    private static final String HOURS_VALID_PROPERTY_NAME = "num-hrs-valid";
+
     /**
      * This is the main method that handles all view request. The first time the request
      * is made to enter the data.
@@ -82,7 +84,7 @@
         HttpServletRequest request = getEnvironment().getRequest();
 
         try {
-            String hrsValid = getResourceConfigProperty("num-hrs-valid");
+            String hrsValid = getResourceConfigProperty(HOURS_VALID_PROPERTY_NAME);
             if(hrsValid != null && !hrsValid.equals("")) {
                 totalValidHrs = Long.parseLong(hrsValid);
             } else {
@@ -270,13 +272,16 @@
                     ResetPWExpire pwexp = new ResetPWExpire(userList[i].getID(), new Date().getTime(), guid, userList[i].getEmail());
                     Map<String, ResetPWExpire> pwHM = getOblivionMap(getEnvironment().getRequest());
                     pwHM.put(pwexp.getGuid(), pwexp);
-                    String emailStr = "Please go to the following URL to reset password: <" + getURL() + "?pwresetid=" + guid + ">.";
-                    log.debug(emailStr);
+                    String emailSubject = "Reset password request needs your confirmation";
+                    String emailBody = "Please go to the following URL to reset password: <" + getURL() + "?pwresetid=" + guid + ">.";
+                    String hrsValid = getResourceConfigProperty(HOURS_VALID_PROPERTY_NAME);
+                    emailBody = emailBody + "\n\nNOTE: This link is only available during the next " + hrsValid + " hours!";
+                    if (log.isDebugEnabled()) log.debug(emailBody);
                     String emailServer = getResourceConfigProperty(SMTP_HOST_PROPERTY_NAME);
                     int port = Integer.parseInt(getResourceConfigProperty("smtpPort"));
                     String from = getResourceConfigProperty("smtpFrom");
                     String to =  userList[i].getEmail();
-                    SendMail.send(emailServer, port, from, to, "Reset password request needs your confirmation", emailStr);
+                    SendMail.send(emailServer, port, from, to, emailSubject, emailBody);
                     String xmlStrVal = generateXML(pwexp);
 
 



More information about the Yanel-commits mailing list