1 package org.sourceforge.vlibrary.user.forms;
2
3 import javax.servlet.http.HttpServletRequest;
4 import org.apache.struts.action.ActionMessage;
5 import org.apache.struts.action.ActionErrors;
6 import org.apache.struts.action.ActionMapping;
7 import org.apache.struts.util.MessageResources;
8 import org.apache.log4j.Logger;
9
10
11
12
13
14
15
16
17
18
19
20
21 public final class ForgotPasswordForm extends LibraryForm {
22 private static final long serialVersionUID = 0;
23
24
25 private static Logger logger =
26 Logger.getLogger(ForgotPasswordForm.class.getName());
27
28
29 private static MessageResources messages =
30 MessageResources.getMessageResources("ApplicationResources");
31
32
33
34
35
36 private String email=null;
37 private String uid=null;
38
39 public String getClassName() {
40 return ForgotPasswordForm.class.getName();
41 }
42
43 public String getEmail() {
44 return email;
45 }
46
47 public void setEmail(String email) {
48 this.email = email;
49 }
50
51 public String getUid() {
52 return uid;
53 }
54
55 public void setUid(String uid) {
56 this.uid = uid;
57 }
58
59
60
61
62
63
64
65 public void reset(ActionMapping mapping, HttpServletRequest request) {
66 this.email = null;
67 this.uid = null;
68 }
69
70
71
72
73
74
75
76
77
78
79
80 public ActionErrors validate(ActionMapping mapping,
81 HttpServletRequest request) {
82
83 if (logger.isDebugEnabled()) {
84 logger.debug(messages.getMessage("entering.validate"));
85 }
86
87 ActionErrors errors = new ActionErrors();
88
89 if ((email == null) || (email.length() < 1)) {
90 errors.add("email",
91 new ActionMessage("error.reader.email.required"));
92 }
93
94 if ((uid == null) || (uid.length() < 1)) {
95 errors.add("uid",
96 new ActionMessage("error.reader.uid.required"));
97 }
98
99 if (logger.isDebugEnabled() && errors.isEmpty()) {
100 logger.debug(messages.getMessage("validate.successful"));
101 }
102
103 return errors;
104 }
105
106 }