doForgotPassword( event, request );
return;
}
/* Send */
PortletContext ctx = event.getPortlet( ).getPortletConfig( ).getPortletContext( );
UserService usr = ( UserService ) ctx.getService( UserService.NAME );
try
{
/* Get the user */
UserImpl u = ( UserImpl ) usr.getUserByEmail( email );
/* Generate the email message */
String subject = "Password Requested";
StringBuffer body = new StringBuffer();
body.append( u.getFirstname( ) + " " + u.getLastname( ) + "\n" );
body.append( "Here is your requested password\n" );
body.append( " Login: " + u.getId( ) + "\n" );
body.append( " Password: " + u.getPassword( ) + "\n\n" );
/* Send the message */
MailService mailer = ( MailService ) ctx.getService( MailService.NAME );
mailer.send( null, new Address[] { new InternetAddress( u.getEmail( ) ) }, subject, body.toString(), MailService.MIME_TEXT );
}
catch ( UserNotFoundException u )
{
ctx.getLog( ).warn( email + " not found", u );
}
catch ( Exception e )
{
throw new PortletException( e );
}