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

mmbk created an issue. See original summary.

larisse’s picture

Issue summary: View changes

Hi! I made a patch in Password Policy module that I think solve this dependence: #3213457: Support for Masquerade module

larisse’s picture

Status: Needs work » Needs review

.

hmendes’s picture

Hello!
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?

andypost’s picture

That'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)

andypost’s picture

Status: Needs review » Active

proper state as no patch

gngn’s picture

The 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 ...

solideogloria’s picture

Status: Active » Needs review

I'm going to mark as NR. Someone should check if the Password Policy module update fixed their issues.

andypost’s picture

Status: Needs review » Active

There's no patch for the module so nothing to review, please move the issue to password policy module

solideogloria’s picture

Status: Active » Closed (outdated)

Since that module already has an issue for supporting Masquerade, I think this can be closed.