[seam-commits] Seam SVN: r7492 - trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Feb 28 03:43:43 EST 2008
Author: christian.bauer at jboss.com
Date: 2008-02-28 03:43:43 -0500 (Thu, 28 Feb 2008)
New Revision: 7492
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserPasswordReset.java
Log:
JBSEAM-2687, activate inactive account on password reset
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java 2008-02-27 14:31:31 UTC (rev 7491)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java 2008-02-28 08:43:43 UTC (rev 7492)
@@ -15,12 +15,9 @@
import org.jboss.seam.wiki.core.dao.TagDAO;
import org.jboss.seam.wiki.core.model.DisplayTagCount;
import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.wiki.core.model.WikiFile;
import javax.faces.application.FacesMessage;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedSet;
+import java.util.*;
import java.io.Serializable;
/**
@@ -40,7 +37,7 @@
@In
private FacesMessages facesMessages;
- private SortedSet<String> tags;
+ private SortedSet<String> tags = new TreeSet<String>();
private String newTag;
private List<DisplayTagCount> popularTags;
@@ -53,7 +50,7 @@
}
public List<String> getTagsAsList() {
- return new ArrayList<String>(tags);
+ return tags != null ? new ArrayList<String>(tags) : Collections.EMPTY_LIST;
}
public String getNewTag() {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserPasswordReset.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserPasswordReset.java 2008-02-27 14:31:31 UTC (rev 7491)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserPasswordReset.java 2008-02-28 08:43:43 UTC (rev 7492)
@@ -30,6 +30,24 @@
import java.util.regex.Pattern;
/**
+ * The password reset feature works as follows:
+ *
+ * - User enters username and e-mail address. The account does not have to be activated, so
+ * the "Reset Password" functionality can also serve as "Resend Activation E-Mail".
+ *
+ * - Both username and e-mail address are checked with what we have in the database.
+ *
+ * - An activation code is generated and stored in the database for this user account.
+ *
+ * - An e-mail with the activation code is send to the users e-mail address.
+ *
+ * - If the user clicks on the activation link, the login form on the page will
+ * switch to a password reset form. (If the activation code was correct.)
+ *
+ * - After typing in the password twice, the user account gets a new password and
+ * we also activate it.
+ *
+ *
* @author Christian Bauer
*/
@Name("userPasswordReset")
@@ -155,6 +173,10 @@
User persistentUser = userDAO.findUser(user.getId());
persistentUser.setPasswordHash(hashUtil.hash(getPassword()));
+
+ // As a side effect, also activate the user! http://jira.jboss.com/jira/browse/JBSEAM-2687
+ persistentUser.setActivated(true);
+
Contexts.getSessionContext().remove(RESET_PASSWORD_OF_USER);
facesMessages.addFromResourceBundleOrDefault(
More information about the seam-commits
mailing list