[jboss-user] [JBoss Portal] - Re: Access UserModule from a portlet when not authenticated

indyJones do-not-reply at jboss.com
Fri Aug 3 11:14:52 EDT 2007


ok...got it to work...here is how I did it using JSF...

Get the userModule through JNDI


  | 
  | userModule = (UserModule) new InitialContext().lookup("java:portal/UserModule");
  | 
  | 


Get the user by using its user id....NOT user name....

DO THIS


  | 
  | User test = userModule.findUserById(id);
  | 
  | 

DO NOT DO THIS


  | 
  | User test = userModule.findUserByUserName("admin");
  | 
  | 

I basically wrote a simple Hibernate service layer to get the user id after a email is given and the answer to the secret question is correct.

Then, create a new password and change it


  | 
  | test.updatePassword(newpassword);
  | 
  | 

Then fire an email off to the user with their new password. I used ...


  | 
  | Session session = (Session) new InitialContext().lookup("java:Mail");  
  | 
  | 

That is configured through the deploy/mail-service.xml file. The Forums Portlet uses the same service

POOF! I now have a self managed user password system...AKA..."Forgot My Password" link

Indy 

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070663



More information about the jboss-user mailing list