use of password.pwm.http.bean.UpdateProfileBean in project pwm by pwm-project.
the class UpdateProfileServlet method handleEnterCodeRequest.
@ActionHandler(action = "enterCode")
ProcessStatus handleEnterCodeRequest(final PwmRequest pwmRequest) throws PwmUnrecoverableException, ServletException, IOException {
setLastError(pwmRequest, null);
final UpdateProfileBean updateProfileBean = getBean(pwmRequest);
final UpdateProfileProfile updateProfileProfile = getProfile(pwmRequest);
final String userEnteredCode = pwmRequest.readParameterAsString(PwmConstants.PARAM_TOKEN);
final TokenDestinationItem tokenDestinationItem = UpdateProfileUtil.tokenDestinationItemForCurrentValidation(pwmRequest, updateProfileBean, updateProfileProfile);
ErrorInformation errorInformation = null;
try {
TokenUtil.checkEnteredCode(pwmRequest, userEnteredCode, tokenDestinationItem, pwmRequest.getUserInfoIfLoggedIn(), TokenType.UPDATE, TokenService.TokenEntryType.authenticated);
} catch (PwmUnrecoverableException e) {
LOGGER.debug(pwmRequest, "error while checking entered token: ");
errorInformation = e.getErrorInformation();
}
if (errorInformation != null) {
setLastError(pwmRequest, errorInformation);
UpdateProfileUtil.forwardToEnterCode(pwmRequest, updateProfileProfile, updateProfileBean);
return ProcessStatus.Halt;
}
LOGGER.debug(pwmRequest, "marking token as passed " + JsonUtil.serialize(tokenDestinationItem));
updateProfileBean.getCompletedTokenFields().add(updateProfileBean.getCurrentTokenField());
updateProfileBean.setTokenSent(false);
updateProfileBean.setCurrentTokenField(null);
if (pwmRequest.getConfig().readSettingAsBoolean(PwmSetting.DISPLAY_TOKEN_SUCCESS_BUTTON)) {
pwmRequest.setAttribute(PwmRequestAttribute.TokenDestItems, tokenDestinationItem);
pwmRequest.forwardToJsp(JspUrl.UPDATE_ATTRIBUTES_TOKEN_SUCCESS);
return ProcessStatus.Halt;
}
return ProcessStatus.Continue;
}
use of password.pwm.http.bean.UpdateProfileBean in project pwm by pwm-project.
the class UpdateProfileServlet method handleConfirmRequest.
@ActionHandler(action = "confirm")
ProcessStatus handleConfirmRequest(final PwmRequest pwmRequest) throws PwmUnrecoverableException {
final UpdateProfileBean updateProfileBean = getBean(pwmRequest);
updateProfileBean.setConfirmationPassed(true);
return ProcessStatus.Continue;
}
Aggregations