When resetting passwords by role, the following bugs were encountered:
Users assigned to multiple roles were being saved more than once (when selecting multiple roles that were assigned to those users)
Password reset fails when selecting the "Authenticated users" role
Confirmation message prints the array keys (including unselected values) instead of the role names.
This PR addresses the above issues - the only logic changes are in submitForm(). Note that UserStorage::loadByProperties(['roles' => [...]]) can take an array of multiple roles and then uses an "IN" condition in the query, so a user assigned to many roles is still only loaded once.
Also some general syntax and doc cleanup issues identified by phpcs (below).
FILE: ...s/drupal8-git/modules/password_policy/src/Form/PasswordReset.php
----------------------------------------------------------------------
FOUND 14 ERRORS AFFECTING 10 LINES
----------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
14 | ERROR | [x] Missing class doc comment
16 | ERROR | [ ] Missing short description in doc comment
19 | ERROR | [ ] Class property $role_storage should use lowerCamel
| | naming without underscores
21 | ERROR | [ ] Missing short description in doc comment
24 | ERROR | [ ] Class property $user_storage should use lowerCamel
| | naming without underscores
26 | ERROR | [x] Missing function doc comment
27 | ERROR | [ ] Inline doc block comments are not allowed; use "/*
| | Comment */" or "// Comment" instead
32 | ERROR | [x] Missing function doc comment
32 | ERROR | [ ] Visibility must be declared on method "__construct"
90 | ERROR | [x] Expected 1 space before "=="; 0 found
90 | ERROR | [x] Expected 1 space after "=="; 0 found
90 | ERROR | [x] Expected 1 space before "=="; 0 found
90 | ERROR | [x] Expected 1 space after "=="; 0 found
When resetting passwords by role, the following bugs were encountered:
This PR addresses the above issues - the only logic changes are in
submitForm()
. Note thatUserStorage::loadByProperties(['roles' => [...]])
can take an array of multiple roles and then uses an "IN" condition in the query, so a user assigned to many roles is still only loaded once.Also some general syntax and doc cleanup issues identified by phpcs (below).