Problem
The Password Policy module is a popular security module which allows site admins to define password policies on a site.
One such policy is the ability to force the user to change their password every so often. When this policy is enforced users are forced to the password change screen once they login and forbidden to travel elsewhere on the site, every click brings them back to the password change screen.
When an admin masquerades as a user whose password has expired they are forced to the password edit screen. The admin is then unable to click the Switch back link as doing so brings them back to the users password edit screen.
Solution
Password policy module provides hook_password_policy_expire_url_exclude() to allow modules to define paths which should not force a redirection.
Given the popularity of the password policy module I suggest that it is OK for masquerade to support it and implement this hook.
Disclaimer
This is cloned from the 7.x-dev Issue, the same problem exists in Drupal 8/9 with the 8.x version. I had a quick look into the patch and the 8.x code, it seems that this was not ported to D8. I'm not sure whether the solution will be the same, but I'll check this out.
Comments
Comment #2
larisse commentedHi! I made a patch in Password Policy module that I think solve this dependence: #3213457: Support for Masquerade module
Comment #3
larisse commented.
Comment #4
hmendes commentedHello!
This problem seems to be solved in the Password Policy module, and the comment from @larisse in #2 shows that it is being fixed there.
Shouldn't we close this issue and leave just the #3213457: Support for Masquerade module issue?
Comment #5
andypostThat's interesting case, but I suppose it as close as designed as masquerade making real login and everything should behave as you're the real user (except session flag to be able to unmasquerade)
Comment #6
andypostproper state as no patch
Comment #7
gngn commentedThe password policy issue #3213457: Support for Masquerade module is Closed (fixed) so I agree with hmendes in #4 that we can close this one.
But I do not know if the fix is included in current password policy 8.x-3.2 and/or 4.0.0 ...
Comment #8
solideogloria commentedI'm going to mark as NR. Someone should check if the Password Policy module update fixed their issues.
Comment #9
andypostThere's no patch for the module so nothing to review, please move the issue to password policy module
Comment #10
solideogloria commentedSince that module already has an issue for supporting Masquerade, I think this can be closed.