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);
}
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;
}
Aggregations