Search in sources :

Example 6 with UpdateProfileBean

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;
}
Also used : ErrorInformation(password.pwm.error.ErrorInformation) UpdateProfileBean(password.pwm.http.bean.UpdateProfileBean) UpdateProfileProfile(password.pwm.config.profile.UpdateProfileProfile) PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException) TokenDestinationItem(password.pwm.bean.TokenDestinationItem)

Example 7 with UpdateProfileBean

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;
}
Also used : UpdateProfileBean(password.pwm.http.bean.UpdateProfileBean)

Aggregations

UpdateProfileBean (password.pwm.http.bean.UpdateProfileBean)7 UpdateProfileProfile (password.pwm.config.profile.UpdateProfileProfile)4 FormConfiguration (password.pwm.config.value.data.FormConfiguration)2 ErrorInformation (password.pwm.error.ErrorInformation)2 PwmOperationalException (password.pwm.error.PwmOperationalException)2 ChaiUser (com.novell.ldapchai.ChaiUser)1 ChaiException (com.novell.ldapchai.exception.ChaiException)1 PwmApplication (password.pwm.PwmApplication)1 TokenDestinationItem (password.pwm.bean.TokenDestinationItem)1 PwmException (password.pwm.error.PwmException)1 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)1 PwmSession (password.pwm.http.PwmSession)1 AuditRecord (password.pwm.svc.event.AuditRecord)1 AuditRecordFactory (password.pwm.svc.event.AuditRecordFactory)1 MacroMachine (password.pwm.util.macro.MacroMachine)1