View Javadoc

1   package org.sourceforge.vlibrary.user.actions;
2   
3   import java.util.ArrayList;
4   import javax.servlet.http.HttpServletRequest;
5   import javax.servlet.http.HttpServletResponse;
6   import org.apache.struts.action.ActionForm;
7   import org.apache.struts.action.ActionForward;
8   import org.apache.struts.action.ActionMapping;
9   import org.apache.struts.util.MessageResources;
10  import org.apache.log4j.Logger;
11  
12  import org.sourceforge.vlibrary.exceptions.LibraryException;
13  import org.sourceforge.vlibrary.user.forms.ForgotPasswordForm;
14  
15  /**
16   * Action used to process the ForgotMyPassword entry form
17   * @version $Revision$ $Date$
18   */
19  
20  public class ForgotPasswordAction extends LibraryAction {
21      
22      /** log4j Logger */
23      private static Logger logger =
24       Logger.getLogger(ForgotPasswordAction.class.getName());
25      
26      
27      /**
28       *
29       * Just pass the request to the Facade and "No news is good news"
30       *
31       * @param mapping The ActionMapping used to select this instance
32       * @param form The optional ActionForm bean for this request (if any)
33       * @param request The HTTP request we are processing
34       * @param response The HTTP response we are creating
35       * @param messages message resources
36       *
37       * @exception Exception
38       */
39      public ActionForward executeAction(ActionMapping mapping,
40       ActionForm form,
41       HttpServletRequest request,
42       HttpServletResponse response,
43       MessageResources messages)
44       throws Exception {
45          
46          ArrayList errors = new ArrayList();
47          
48          try {
49              ForgotPasswordForm frm = (ForgotPasswordForm)form;
50              
51              libraryManager.forgotPassword(frm.getUid(), frm.getEmail() );
52          } catch (Throwable t) {
53              String errString = messages.getMessage("error.forgotPassword", t.getMessage());
54              logger.error(errString,t);
55              errors.add(new LibraryException(errString,t));
56          }
57          
58          return standardForward(mapping,request,errors);
59      }
60  }