Search in sources :

Example 1 with DeleteAccountBean

use of password.pwm.http.bean.DeleteAccountBean in project pwm by pwm-project.

the class DeleteAccountServlet method nextStep.

@Override
protected void nextStep(final PwmRequest pwmRequest) throws PwmUnrecoverableException, IOException, ChaiUnavailableException, ServletException {
    final DeleteAccountProfile profile = getProfile(pwmRequest);
    final DeleteAccountBean bean = getBean(pwmRequest);
    final String selfDeleteAgreementText = profile.readSettingAsLocalizedString(PwmSetting.DELETE_ACCOUNT_AGREEMENT, pwmRequest.getPwmSession().getSessionStateBean().getLocale());
    if (selfDeleteAgreementText != null && !selfDeleteAgreementText.trim().isEmpty()) {
        if (!bean.isAgreementPassed()) {
            final MacroMachine macroMachine = pwmRequest.getPwmSession().getSessionManager().getMacroMachine(pwmRequest.getPwmApplication());
            final String expandedText = macroMachine.expandMacros(selfDeleteAgreementText);
            pwmRequest.setAttribute(PwmRequestAttribute.AgreementText, expandedText);
            pwmRequest.forwardToJsp(JspUrl.SELF_DELETE_AGREE);
            return;
        }
    }
    pwmRequest.forwardToJsp(JspUrl.SELF_DELETE_CONFIRM);
}
Also used : DeleteAccountBean(password.pwm.http.bean.DeleteAccountBean) DeleteAccountProfile(password.pwm.config.profile.DeleteAccountProfile) MacroMachine(password.pwm.util.macro.MacroMachine)

Example 2 with DeleteAccountBean

use of password.pwm.http.bean.DeleteAccountBean in project pwm by pwm-project.

the class DeleteAccountServlet method handleAgreeRequest.

@ActionHandler(action = "agree")
private ProcessStatus handleAgreeRequest(final PwmRequest pwmRequest) throws ServletException, IOException, PwmUnrecoverableException, ChaiUnavailableException {
    LOGGER.debug(pwmRequest, "user accepted agreement");
    final DeleteAccountBean deleteAccountBean = getBean(pwmRequest);
    if (!deleteAccountBean.isAgreementPassed()) {
        deleteAccountBean.setAgreementPassed(true);
        final AuditRecord auditRecord = new AuditRecordFactory(pwmRequest).createUserAuditRecord(AuditEvent.AGREEMENT_PASSED, pwmRequest.getUserInfoIfLoggedIn(), pwmRequest.getSessionLabel(), ProfileType.DeleteAccount.toString());
        pwmRequest.getPwmApplication().getAuditManager().submit(auditRecord);
    }
    return ProcessStatus.Continue;
}
Also used : DeleteAccountBean(password.pwm.http.bean.DeleteAccountBean) AuditRecordFactory(password.pwm.svc.event.AuditRecordFactory) AuditRecord(password.pwm.svc.event.AuditRecord)

Aggregations

DeleteAccountBean (password.pwm.http.bean.DeleteAccountBean)2 DeleteAccountProfile (password.pwm.config.profile.DeleteAccountProfile)1 AuditRecord (password.pwm.svc.event.AuditRecord)1 AuditRecordFactory (password.pwm.svc.event.AuditRecordFactory)1 MacroMachine (password.pwm.util.macro.MacroMachine)1