1   package ch.ige.edossier.web.struts;
2   
3   import javax.servlet.http.HttpServletRequest;
4   import org.apache.struts.action.*;
5   
6   /**
7    * B32.03 - eDossier-Interceptions - Diplomarbeit an der Software-Schule Schweiz<br>
8    * MUSS-ZIEL [M1] - Login Authentifizierung (Pflichtenheft b32.03_PF_eDossier.pdf, Seite 16)<br>
9    * Die Klasse LoginForm ist die Datenhaltung der login.jsp.
10   * <p>
11   * Copyright (c) 2004, Eidgenössisches Institut für Geistiges Eigentum
12   * @author    Anita Rueegsegger, Marc Bouquet
13   * @version   $Id: LoginForm.java,v 1.9 2004/10/22 01:58:23 bouquet Exp $
14   */
15  public class LoginForm extends ActionForm
16  {
17    private String txfEmail;
18    private String txfPW;
19  
20    //*******************************************************************************************************************
21     //  G E T T E R -  U N D  S E T T E R - M E T H O D E N  D E R  A C T I O N F O R M
22     //*******************************************************************************************************************
23  
24      public String getTxfEmail()
25      {
26        return txfEmail;
27      }
28  
29    public void setTxfEmail( String txfEmail )
30    {
31      this.txfEmail = txfEmail;
32    }
33  
34    public String getTxfPW()
35    {
36      return txfPW;
37    }
38  
39    public void setTxfPW( String txfPW )
40    {
41      this.txfPW = txfPW;
42    }
43  
44    /**
45     * Diese Methode prüft die eingegeben Daten auf der JSP und fügt diese im Fehlerfall in die
46     * ActionErrors.
47     * @param actionMapping ActionMapping
48     * @param httpServletRequest HttpServletRequest
49     * @return ActionErrors
50     */
51    public ActionErrors validate( ActionMapping actionMapping, HttpServletRequest httpServletRequest )
52    {
53      ActionErrors errors = new ActionErrors();
54  
55      if( txfEmail == null || txfEmail.equals( "" ) )
56      {
57        errors.add( "txfEmail", new ActionError( "validate.login.loginRequired" ) );
58      }
59      else if( txfEmail.length() > 50 )
60      {
61        errors.add( "txfEmail", new ActionError( "validate.login.loginLength" ) );
62      }
63      else if( txfEmail.indexOf( "@" ) == -1 )
64      {
65        errors.add( "txfEmail", new ActionError( "validate.login.loginNotValid" ) );
66      }
67      if( txfPW == null || txfPW.equalsIgnoreCase( "" ) )
68      {
69        errors.add( "txfPW", new ActionError( "validate.login.passwordRequired" ) );
70      }
71      return errors;
72    }
73  
74    /**
75     * Diese Methode setzt die Eingabedaten auf der JSP zurück in den Defaultwert
76     * @param actionMapping ActionMapping
77     * @param httpServletRequest HttpServletRequest
78     */
79    public void reset( ActionMapping actionMapping, HttpServletRequest httpServletRequest )
80    {
81      txfEmail = "";
82      txfPW = "";
83    }
84  }
85