Source code: com/clra/web/ValidateMemberPassword.java
1 /*
2 * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3 * Distributed under the GPL license. See doc/COPYING.
4 * $RCSfile: ValidateMemberPassword.java,v $
5 * $Date: 2003/02/26 03:38:46 $
6 * $Revision: 1.3 $
7 */
8
9 package com.clra.web;
10
11 import org.apache.struts.action.ActionError;
12 import org.apache.struts.action.ActionErrors;
13
14 /**
15 * Checks whether a password matches its confirmation value.
16 *
17 * @version $Id: ValidateMemberPassword.java,v 1.3 2003/02/26 03:38:46 rphall Exp $
18 * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
19 */
20 class ValidateMemberPassword extends ValidateMember {
21
22 public final static String PROPERTY_PASSWORD = "password";
23
24 ValidateMemberPassword( MemberInfoForm f ) {
25 super( f );
26 }
27
28 /**
29 * Checks whether a password matches its confirmation value.
30 */
31 void validate( ActionErrors errors ) {
32 if ( errors == null ) {
33 throw new IllegalArgumentException( "null action errors" );
34 }
35
36 String messageKey = "validate.member.password.missing";
37 String password = this.form.getAccountPassword();
38 validateRequiredValue( PROPERTY_PASSWORD, messageKey, password, errors );
39
40 messageKey = "validate.member.password.confirm";
41 String confirm = this.form.getConfirmPassword();
42 validateRequiredValue( PROPERTY_PASSWORD, messageKey, confirm, errors );
43
44 if ( password != null && confirm != null && !password.equals(confirm) ) {
45 messageKey = "validate.member.password.notconfirmed";
46 ActionError ae = new ActionError( messageKey );
47 errors.add( PROPERTY_PASSWORD, ae );
48 }
49
50 }
51
52 } // ValidateMemberPassword
53
54 /*
55 * $Log: ValidateMemberPassword.java,v $
56 * Revision 1.3 2003/02/26 03:38:46 rphall
57 * Added copyright and GPL license
58 *
59 * Revision 1.2 2003/02/19 03:31:14 rphall
60 * Implemented validation; removed stubbing
61 *
62 * Revision 1.1 2003/02/11 21:13:15 rphall
63 * Separate class for specific validation task; stubbed implementation
64 *
65 */
66