1 package org.itracker.web.actions.user; 2 3 import org.apache.log4j.Logger; 4 import org.apache.struts.action.*; 5 import org.itracker.web.actions.base.ItrackerBaseAction; 6 import org.itracker.web.forms.ForgotPasswordForm; 7 8 import javax.servlet.ServletException; 9 import javax.servlet.http.HttpServletRequest; 10 import javax.servlet.http.HttpServletResponse; 11 import java.io.IOException; 12 13 public class ForgotPasswordFormAction extends ItrackerBaseAction { 14 private static final Logger log = Logger.getLogger(ForgotPasswordFormAction.class); 15 16 17 public ActionForward execute(ActionMapping mapping, 18 ActionForm form, 19 HttpServletRequest request, 20 HttpServletResponse response) 21 throws ServletException, IOException { 22 ActionMessages errors = new ActionMessages(); 23 24 try { 25 ForgotPasswordFormker/web/forms/ForgotPasswordForm.html#ForgotPasswordForm">ForgotPasswordForm forgotPasswordForm = (ForgotPasswordForm) form; 26 if (forgotPasswordForm == null) { 27 forgotPasswordForm = new ForgotPasswordForm(); 28 } 29 if (errors.isEmpty()) { 30 request.setAttribute("forgotPasswordForm", forgotPasswordForm); 31 saveToken(request); 32 return mapping.getInputForward(); 33 } 34 } catch (Exception e) { 35 log.error("Exception while creating forgot password form.", e); 36 errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.system")); 37 } 38 39 if (!errors.isEmpty()) { 40 saveErrors(request, errors); 41 } 42 43 return mapping.findForward("error"); 44 45 } 46 47 }