Problem/Motivation
When the user add a new policy and tries to configure the constraint setting, if the minimum length is already set and the user tries to set a maximum length that is lower than the minimum length it allows to save.
The same occurs when the user tries to set another minimum length constraint, and the opposite situation.
Steps to reproduce
Install the Password Character Length Policy extension;
Goes to the configuration page;
Add a new policy;
Click on "Configure Constraint Settings" to add a new password character length;
Add the constraints:
- Number of characters: 8, Opertion: minimum length
- Number of characters: 4, Opertion: minimum length
- Number of characters: 2, Opertion: maximum length
Proposed resolution
Creates a validation to verify if already exists another password character length constraint set.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | 3308607-8.patch | 1.99 KB | chaitanyadessai |
#4 | after-3.png | 21.93 KB | lucassc |
#4 | after-2.png | 22.25 KB | lucassc |
#4 | after-1.png | 21.44 KB | lucassc |
#4 | before-2.png | 27.64 KB | lucassc |
Comments
Comment #2
sophiavs CreditAttribution: sophiavs at CI&T commentedI created the validation when the user are trying to add a new constraint.
Comment #3
lucasscHi!
I'll review.
Comment #4
lucasscGood job, @sophiavs!
I applied patch in #2 for Drupal 9.4.5 and works fine. Looks really good to me, +1 for this patch.
Steps (part 1):
For the previous behavior reported in the IS, please check before-1.png.
After:
constraint 1) Number of characters = 8 and operation = minimum length:
Works as expected.
2) Number of characters = 4 and operation = minimum length:
Error message: The selected operation is already defined. (check after-1.png)
3) Number of characters = 2 and operation = maximum length:
Error message: The selected length is lower than the minimum length defined. (check after-2.png)
constraint 1 deleted.
Steps (part 2):
For the previous behavior please check before-2.png.
After:
4) Number of characters = 2 and operation = maximum length:
Works as expected.
5) Number of characters = 4 and operation = minimum length:
Error message: The selected length is higher than the maximum length defined. (check after-3.png)
Comment #5
lucasscI think it can be marked as RTBC If no one else disagrees.
Comment #6
Kristen PolAssigning to myself as I'm reviewing/merging ready RTBC fixes/updates over the next few days.
Comment #7
Kristen PolThis is working as expected. Note that if you already had constraints added, it doesn't check those when saving. This is only relevant for new policies.
Thanks for the work on this issue. This is a nice little UX improvement.
Reviewing the code:
1. This is misspelled:
$constaint
2. This shouldn't be inside the loop since it doesn't change:
3. And, since there are other changes, I think these two variable names should change:
* Change
$other_operation
to$constraint_operation
* Change
$other_length
to$constraint_length
Comment #8
chaitanyadessai CreditAttribution: chaitanyadessai at Specbee commentedAdded patch please review.
Comment #9
Kristen PolAssigning to myself to review, and changing this to 4.0.0.
Comment #11
Kristen PolThanks everyone. I improved the messages a bit. Merged and will be in the next release.
Comment #13
Kristen PolThis is part of the new 4.0.1 release.