[jboss-cvs] jboss-seam/examples/seamspace/src/org/jboss/seam/example/seamspace ...
Shane Bryzak
Shane_Bryzak at symantec.com
Fri Feb 2 11:39:52 EST 2007
User: sbryzak2
Date: 07/02/02 11:39:52
Modified: examples/seamspace/src/org/jboss/seam/example/seamspace
Register.java RegisterAction.java
Log:
JBSEAM-738
Revision Changes Path
1.7 +4 -0 jboss-seam/examples/seamspace/src/org/jboss/seam/example/seamspace/Register.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Register.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/seamspace/src/org/jboss/seam/example/seamspace/Register.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Register.java 30 Jan 2007 00:14:34 -0000 1.6
+++ Register.java 2 Feb 2007 16:39:52 -0000 1.7
@@ -22,5 +22,9 @@
boolean isVerified();
+ String getCaptchaId();
+ String getVerifyCaptcha();
+ void setVerifyCaptcha(String verifyCaptcha);
+
void destroy();
}
1.9 +36 -1 jboss-seam/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RegisterAction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- RegisterAction.java 31 Jan 2007 02:56:07 -0000 1.8
+++ RegisterAction.java 2 Feb 2007 16:39:52 -0000 1.9
@@ -1,12 +1,12 @@
package org.jboss.seam.example.seamspace;
+import java.rmi.server.UID;
import java.util.Date;
import java.util.HashSet;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
-import javax.security.auth.login.LoginException;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Destroy;
@@ -15,7 +15,9 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
+import org.jboss.seam.core.Conversation;
import org.jboss.seam.core.FacesMessages;
+import org.jboss.seam.security.CaptchaService;
import org.jboss.seam.security.Identity;
@Stateful
@@ -43,10 +45,14 @@
private boolean verified;
+ private String captchaId;
+ private String verifyCaptcha;
+
@Factory("newMember") @Begin
public void start()
{
newMember = new Member();
+ captchaId = new UID().toString().replace(":", "-");
}
public void next()
@@ -59,6 +65,20 @@
{
FacesMessages.instance().add("confirmPassword", "Passwords do not match");
}
+
+ try
+ {
+ if (!CaptchaService.instance().getService().validateResponseForID(
+ getCaptchaId(), verifyCaptcha))
+ {
+ FacesMessages.instance().add("verifyCaptcha", "Verification incorrect");
+ verified = false;
+ }
+ }
+ catch (Exception ex)
+ {
+ verified = false;
+ }
}
@End
@@ -138,6 +158,21 @@
return verified;
}
+ public String getCaptchaId()
+ {
+ return captchaId;
+ }
+
+ public String getVerifyCaptcha()
+ {
+ return verifyCaptcha;
+ }
+
+ public void setVerifyCaptcha(String verifyCaptcha)
+ {
+ this.verifyCaptcha = verifyCaptcha;
+ }
+
@Destroy @Remove
public void destroy() {}
}
More information about the jboss-cvs-commits
mailing list