SignonForm frm = ( SignonForm ) form;
Account account = frm.getAccount( );
String redirectUri = frm.getRedirectUri( );
Petstore petstore = getPetstore( );
if ( petstore.authenticate( account.getUserId( ), account.getPassword( ) ) )
{
Customer cust = petstore.getCustomer( account.getUserId( ) );
initSession( cust, request );
if ( ( redirectUri == null ) || ( redirectUri.length( ) == 0 ) )
{
return mapping.findForward( SUCCESS );
}
else
{
_log.info( "...redirecting to: " + redirectUri );
response.sendRedirect( redirectUri );
return null;
}
}
else
{
request.setAttribute( MESSAGE_KEY, getString( "authentication_failed" ) );
return mapping.findForward( ERROR );
}