Closed (fixed)
Project:
Password Policy
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 May 2021 at 17:21 UTC
Updated:
18 Oct 2022 at 11:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
larisse commentedI think this patch can help.
Comment #3
andypostInstead of moduleExists call the cleaner approach is to use hasService(masquerade) and use it
Comment #4
larisse commentedChanging the patch to what @andypost said in comment #3.
Comment #5
andypostThat looks better @larisse
Needs work for
-
$module_handlervariable name needs change,$has_masqueradeor kinda- coding standards, report at https://www.drupal.org/pift-ci-job/2059338
Comment #6
andypostCode comment (which breaks coding standards) is useless - please remove it entirely. There's git history for thst purpose
Comment #7
larisse commentedHello @andypost!
Follows the patch with the changes.
Comment #8
hmendes commentedReviewed patch from #7 and it worked fine, requesting the password update only when logging with the user, not when masquerading with it, changing to RTBC.
Tested with Drupal 9.1.6, Masquerade 8.x-2.x-dev and Password_policy 8.x-3.x-dev.
Comment #9
nerdsteinThanks for posting this and helping us get more interoperability between the modules.
@hmendes - I am curious what experience we are offering the end users. Should we proactively show a masqueraded users a message when they get to the edit form with the password? Should we hide any of the form elements? Maybe this is managed upstream through the masquerade module, but I'd like more details if this patch needs to be improved.
The patch only seems to block masqueraded users from leveraging the service. We should consider having an automated test as well.
I am going to move back to "needs work" until I get some clarity on the experience and hopefully a test.
Comment #10
hmendes commentedHello @nerdstein, thank you for the reply.
I think the patch was made to let the administrator masquerade as the user without having to reset its password ( when the password is expired ) and for this specific problem I think the patch works the way it should.
Steps:
I'm not a masquerade maintainer, but from what i see, the module is mainly for site designers to see what their site look like for their users, so I don't think we should let the admin know that the user password is expired when masquerading with it, but I do think that if the administrator wants to change the password of the user, it should respect the constraints added before and that is happening even when the masqueraded user tries to change the password.
Also, if I'm masking myself as a user with an expired password, I can't unmask until I update the password, so if we're letting the admin see that the password has expired, he should let him unmask since we're not logged in with the user, just masking as it.
Comment #11
gngn commented#7 worked for me.
Comment #15
sophie.skOne of my clients has run into this problem this week.
I've updated the issue fork - rebased against the latest dev version, reverted a previous commit (as this changed comparison operators and didn't have the Masquerade support in it), and added the changes from https://www.drupal.org/project/password_policy/issues/3213457#comment-14...
I agree with @hmendes in https://www.drupal.org/project/password_policy/issues/3213457#comment-14... - this is so that administrators can masquerade as users and browse the site without needing to know or change a user's password. At the moment our administrators are unable to perform their normal tasks (checking that customers have access to the right information) because the customer needs to change their password, but it's not possible to do that.
Comment #16
sophie.skNoticed this was no longer applying, so updated the patch.
Comment #17
paulocsHello Sophie.SK,
Can we use Dependency Injection instead?
Optional parameter reference: https://symfony.com/doc/2.0/book/service_container.html#making-references-optional
Comment #18
sophie.skAhh you called me out on being lazy lol. Yes I can do that this morning :)
Comment #19
sophie.skOkay, added DI - I didn't know you could make arguments optional like that, thank you for the link (though you linked to Symfony 2.0 so had to go digging!). Back to review.
Comment #20
paulocsSorry Sophie.SK, I did not notice the version.
I'll review it.
Comment #22
paulocsThank you all!
Comment #24
gngn commented@paulocs: Is this included in 8.x-3.2?
I did not find anything with Masquerade or #3213457 in the release notes https://www.drupal.org/project/password_policy/releases/8.x-3.2