Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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();
Comment | File | Size | Author |
---|---|---|---|
#9 | 2867089-9.patch | 1017 bytes | nikunjkotecha |
#3 | password_policy-code_logic_will_never_reset-2867089-3.patch | 1.37 KB | mqanneh |
Comments
Comment #2
mqannehComment #3
mqannehChec attached patch.
Comment #4
Ahmad Abbad CreditAttribution: Ahmad Abbad as a volunteer commentedThis patch #3 worked for me.
Comment #5
nerdsteinThis looks good, thank you. Merging.
Comment #7
mqannehComment #8
nikunjkotechaWe 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.
Comment #9
nikunjkotechaFixed issue related to registration page where we don't have user in route params.