use of org.apereo.cas.pm.PasswordChangeBean in project cas by apereo.
the class PasswordChangeAction method doExecute.
@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
try {
final UsernamePasswordCredential c = (UsernamePasswordCredential) WebUtils.getCredential(requestContext);
final PasswordChangeBean bean = requestContext.getFlowScope().get(PasswordManagementWebflowConfigurer.FLOW_VAR_ID_PASSWORD, PasswordChangeBean.class);
if (passwordManagementService.change(c, bean)) {
return new EventFactorySupport().event(this, PASSWORD_UPDATE_SUCCESS);
}
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
requestContext.getMessageContext().addMessage(new MessageBuilder().error().code("pm.updateFailure").defaultText("Could not update the account password").build());
return error();
}
Aggregations