1 package ch.ige.edossier.web.struts;
2
3 import javax.servlet.http.HttpServletRequest;
4 import javax.servlet.http.HttpServletResponse;
5 import org.apache.log4j.Logger;
6 import org.apache.struts.action.*;
7 import ch.ige.edossier.web.server.EDossierControl;
8
9
18 public class PasswordAction extends Action
19 {
20 private static final Logger LOG = Logger.getLogger( PasswordAction.class );
22
23
32 public ActionForward execute( ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse )
33 {
34 ActionErrors errors = new ActionErrors();
35 PasswordForm pwdForm = ( PasswordForm )actionForm;
36 EDossierFacade eFacade = new EDossierControl();
37
38 try
39 {
40 if( eFacade.sendPassword( pwdForm.getTxfEmail(), getLocale( httpServletRequest ).getLanguage() ) )
41 {
42 errors.add( "password", new ActionError( "text.password.send" ) );
43 saveErrors( httpServletRequest, errors );
44 return( actionMapping.findForward( "self" ) );
45 }
46 else
47 {
48 errors.add( "password", new ActionError( "error.password.account" ) );
49 saveErrors( httpServletRequest, errors );
50 return( actionMapping.findForward( "self" ) );
51 }
52 }
53 catch( Exception ex )
54 {
55 LOG.error( "Fehler: " + ex.getMessage() );
56 errors.add( "password", new ActionError( "error.password.send", ex.getMessage() ) );
57 saveErrors( httpServletRequest, errors );
58 return( new ActionForward( actionMapping.getInput() ) );
59 }
60 }
61 }
62