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
17
18
19
20 public class ForgotPasswordAction extends LibraryAction {
21
22
23 private static Logger logger =
24 Logger.getLogger(ForgotPasswordAction.class.getName());
25
26
27
28
29
30
31
32
33
34
35
36
37
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 }