diff --git a/password_policy.module b/password_policy.module index 9666b0e..7c1bff7 100644 --- a/password_policy.module +++ b/password_policy.module @@ -61,8 +61,8 @@ function password_policy_form_user_form_alter(&$form, &$form_state) { $form['#validate'][] = '_password_policy_user_profile_form_validate'; } - // Run the submit handler before the user entity is saved. - array_unshift($form['actions']['submit']['#submit'], '_password_policy_user_profile_form_submit'); + // Add the submit handler. + $form['actions']['submit']['#submit'][] = '_password_policy_user_profile_form_submit'; } /** @@ -286,10 +286,6 @@ function _password_policy_constraints_validate(&$form, FormStateInterface &$form /** * Set last password reset and expiration fields on password update. - * - * Must run before the user entity is saved. Otherwise the user entity will - * not receive the updated values from the form state for last password reset - * and password expiration fields. */ function _password_policy_user_profile_form_submit(array &$form, FormStateInterface $form_state) { $current_pass = $form_state->getValue('current_pass');