After a new user registers I wanted to auto log them in (refactoring for using 
Seam Security).
I assume there is no reason I can't bully the Identity class into logging them 
in for me.

                        
user.setPassword(encryptionController.encrypt(user.getPassword()));
  |                     log.info("Crypted Password:" + user.getPassword());
  |                     em.persist(user);
  |                     if (!Identity.instance().isLoggedIn()) {
  |                             
Identity.instance().setUsername(user.getUsername());
  |                             
Identity.instance().setPassword(user.getPassword());
  |                             Identity.instance().login();
  |                     }
  |                     
facesMessages.addFromResourceBundle("user_create_successful");
  |                     log.info("Leaving Registration conversation." + 
conversation.getId()+")");
  |                     valueToBeReturned = "success";
  | 

Might need a em.flush after the persist as my authentication class looks for 
the username/password on the Dbase... hummm

I also assume I can still just drop the session and things won't go pear shaped 
when someone deletes the user they are logged in as


  |                     if (Identity.instance().isLoggedIn()) {
  |                             if (loggedInUser.getUser().getId().compareTo(
  |                                             userToBeDeleted.getId()) == 0) {
  |                                     // We have deleted ourselves, so force 
a Logout.
  |                                     Seam.invalidateSession();
  |                                     return "mainMenu";
  |                             }
  |                     }
  |                     
facesMessages.addFromResourceBundle("user_delete_successful");
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4013402#4013402

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4013402
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to