PortletRequest req = event.getActionRequest();
ActionResponse res = event.getActionResponse();
PortletSession sess = req.getPortletSession();
Boolean pinValidated = (Boolean) sess.getAttribute(PIN_VALIDATED);
TextBean errorMessage = event.getTextBean("errorMessage");
errorMessage.setStyle("error");
if ( ! isPINValidated(pinValidated) ) {
sess.setAttribute(PIN_VALIDATED, Boolean.FALSE);
errorMessage.setValue("Error. You must enter PIN number.");
setNextState(req, PIN_PROMPT_JSP);
return ;
}
AccountRequest accountRequest =
(AccountRequest)sess.getAttribute(PROCESSING_REQUEST);
if (accountRequest == null) {
errorMessage.setValue("There was an error processing your request. Please click the link in the email you received again to start the process over, or contact the portal administrator if you continue to see this message.");
sess.removeAttribute(PROCESSING_REQUEST);
sess.setAttribute(PIN_VALIDATED, Boolean.FALSE);
setNextState(req, ERROR_JSP);
return ;
}
String password1 = req.getParameter("password1");
String password2 = req.getParameter("password2");
try {
checkPassword(password1, password2, accountRequest);
} catch (Exception e) {
log.info(e.getMessage());
errorMessage.setValue(e.getMessage());
setNextState(req, PASSWORD_PROMPT_JSP);
return ;
}
// activation proc
Map params = new HashMap();
params.put("password", password1);
AccountRequestResult result =
accountService.updateAccount(accountRequest,
AccountRequest.Status.ACTIVATED,
params);
if (result.isError()) {
errorMessage.setValue( result.getMessage() );
setNextState(req, ERROR_JSP);
return ;
}
errorMessage.setValue(null);
sess.removeAttribute(PROCESSING_REQUEST);
sess.removeAttribute(PIN_VALIDATED);
res.setRenderParameter("username", accountRequest.getUsername());