@Override
    protected Event doExecuteInternal(final RequestContext requestContext) {
        val applicationContext = requestContext.getActiveFlow().getApplicationContext();
        val clientInfo = ClientInfoHolder.getClientInfo();

        val bean = getPasswordChangeRequest(requestContext);
        Optional.ofNullable(WebUtils.getCredential(requestContext, UsernamePasswordCredential.class))
            .ifPresent(credential -> bean.setCurrentPassword(credential.getPassword()));

        try {

            LOGGER.debug("Attempting to validate the password change bean for username [{}]", bean.getUsername());
            if (StringUtils.isBlank(bean.getUsername()) || !passwordValidationService.isValid(bean)) {
                LOGGER.error("Failed to validate the provided password");
                return getErrorEvent(requestContext, PASSWORD_VALIDATION_FAILURE_CODE, DEFAULT_MESSAGE);
            }
            if (passwordManagementService.change(bean)) {
                val credential = new UsernamePasswordCredential(bean.getUsername(), bean.toPassword());
                WebUtils.putCredential(requestContext, credential);
                LOGGER.info("Password successfully changed for [{}]", bean.getUsername());

                val email = passwordManagementService.findEmail(PasswordManagementQuery.builder().username(bean.getUsername()).build());
                if (StringUtils.isNotBlank(email)) {
                    val result = sendPasswordResetConfirmationEmailToAccount(bean.getUsername(), email, requestContext);
                    LOGGER.debug("Password reset confirmation email sent to [{}] with result [{}]", result.getTo(), result.isSuccess());
                }
                applicationContext.publishEvent(new PasswordChangeSuccessEvent(this, clientInfo, bean));
                return getSuccessEvent(requestContext, bean);
            }
        } catch (final InvalidPasswordException e) {
            applicationContext.publishEvent(new PasswordChangeFailureEvent(this, clientInfo, bean, e));
            return getErrorEvent(requestContext,
                PASSWORD_VALIDATION_FAILURE_CODE + StringUtils.defaultIfBlank(e.getCode(), StringUtils.EMPTY),
                StringUtils.defaultIfBlank(e.getValidationMessage(), DEFAULT_MESSAGE),
                e.getParams());
        } catch (final Throwable e) {
            applicationContext.publishEvent(new PasswordChangeFailureEvent(this, clientInfo, bean, e));
            LoggingUtils.error(LOGGER, e);
        }
        return getErrorEvent(requestContext, "pm.updateFailure", DEFAULT_MESSAGE);
    }
This is {@link PasswordChangeAction}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/actions/PasswordChangeAction.java