If the password is expired and the user tries to reset his password, the password will be reset successfully but the flag for expired password will not be removed due to undefined variables in the code.

$uid = $form_state->getValue('uid');

$form_state->getValue('uid'); is undefined since the uid in Drupal 8 isn't part of the form state object.

This should be replaced by:

// get the uid from user object.
$user = $form_state->getFormObject()->getEntity();
$uid = $user->id();

Comments

mqanneh created an issue. See original summary.

mqanneh’s picture

Assigned: mqanneh » Unassigned
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.37 KB
mqanneh’s picture

StatusFileSize
new1.37 KB

Chec attached patch.

ahmad abbad’s picture

Status: Needs review » Reviewed & tested by the community

This patch #3 worked for me.

nerdstein’s picture

Status: Reviewed & tested by the community » Fixed

This looks good, thank you. Merging.

  • nerdstein committed cf18340 on 8.x-3.x authored by mqanneh
    Issue #2867089 by mqanneh: Code logic will never reset password expiry
    
mqanneh’s picture

nikunjkotecha’s picture

StatusFileSize
new749 bytes

We are using this at different places, for instance with https://www.drupal.org/project/change_pwd_page.

Recent change here broke as ChangePasswordForm in the contrib module doesn't implement EntityForm.

I suggest we use more generic way of getting current user, that is from route params. Added patch for the same.

nikunjkotecha’s picture

StatusFileSize
new1017 bytes

Fixed issue related to registration page where we don't have user in route params.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.