// captcha first
HttpSession ss = getHttpSesion();
String captcha = (String)ss.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
if (StringUtil.isEmpty(captcha_)) {
_ajaxStub.addMessage(result, new Message(0, MessageType.ERROR,
"Please type in image text."));
return result;
}
if (StringUtil.isEmpty(captcha)) {
_ajaxStub.addMessage(result, new Message(0, MessageType.ERROR,
"Please try again."));
return result;
}
if (!captcha.equals(captcha_)) {
_ajaxStub.addMessage(result, new Message(0, MessageType.ERROR,
"Wrong image text. Please try again."));
return result;
}
try {
if (!_userManager.resetPassword(username_)) {
_ajaxStub.addMessage(result, new Message(0, MessageType.ERROR,
"Unable to reset password!"));
return result;
}
} catch (RealmException e) {
_logger.warn("Failed to reset password.", e);
_ajaxStub.addMessage(result, new Message(0, MessageType.ERROR,
"Failed to reset password."));
return result;
}
_ajaxStub.setStatus(result);