Closed (fixed)
Project:
Password Policy
Version:
8.x-3.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Jul 2019 at 09:21 UTC
Updated:
19 Oct 2020 at 14:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pfrenssenAssigning this, I am going to implement this. I think it is rather a feature request than a bug.
Comment #3
pfrenssenComment #5
claudiu.cristeaI think the solution proposed in issue summary covers also the case when a 3rd party module is suppressing the password in this way:
EDIT: The check would be
!empty($form['account']['pass']['#access']).s/public/protected
Nit: Can be written in a more "API oriented" style:
$this->drupalGet($user->toUrl('edit-form'));In
BrowserTestBasetests is safe to use\Drupal::service()(in this case\Drupal::state()) as, in some circumstances,$this->containeris out-of-sync. In kernel tests$this->container->get()is always safe.Setting to NR, especially for 1.
Comment #6
pfrenssenThanks for the review! I addressed all the remarks. The code is a bit more complex than just
!empty($form['account']['pass']['#access'])because#accessis optional and defaults toTRUEwhen omitted.Comment #8
claudiu.cristeaIndeed! Thank you for the work.
Comment #10
aohrvetpv commentedLooks great, thank you. Committed/pushed, with two reservations:
1. If a contributed module hides the password fields after build, wouldn't there be the same problem? (Is this just moving the problem to another level?)
2. This conditional seems a bit hard to fully understand (to me at least):
I'm not sure I would've understood it without pfrenssen's comment that #access defaults to TRUE when omitted.
Maybe an explanatory comment like this would be helpful?:
Comment #11
claudiu.cristeaIt's true, but is less probable. Modules are usually altering in
hook_form_FORM_ID_alter()orhook_form_alter(). That is the "official" API to alter forms. Of course, a race condition might happen also in after build. We cannot anticipate all cases, but this covers 99.99% of the cases.Comment #13
pfrenssen