While testing out this module's capabilities, I noticed some minor issues with the messages shown to the user when editing a password, a couple of which should be relatively easy to fix.
The order in which the password constraints are shown to users is not particularly logical at present. What is shown for the example policy is:
- Password must have at least 1 letters
- Password must have at least 8 total characters
- Password must have 1 integers
- Password can not match 3 past passwords.
- Password must have at least 1 symbols.
As a user, I'd expect to see an order more like:
- Password must have at least 8 total characters
- Password must have at least 1 letters
- Password must have 1 integers
- Password must have at least 1 symbols.
- Password can not match 3 past passwords.
An easy way to implement this would be by assigning weights to each constraint as part of the plugin definition, and then sorting the constraints by weight instead of alphabetically. This would also be beneficial on the admin pages.
Also, the grammar and consistency of the messages need some cleanup. The int_count message needs to say "at least", consistent with the char_count and symbol_count messages. And all of the messages should use format_plural so that the message is "1 integer" instead of "1 integers".
Finally, an added bonus would be some way to combine the messages for related constraints, so that the display would be more like:
- Password must have at least 8 total characters.
- Password must have at least 1 letter, at least 1 integer, and at least 1 symbol.
- Password can not match 3 past passwords.
However, I'm not sure that there is an easy way to handle that within the flexible plugin architecture, so maybe the last one is just wishful thinking....
Comments
Comment #1
erikwebb commentedThe only reservation I have to implementing a weight to the constraints is that different sites may want a different order and it'd be hard to pick an order that satisfies everyone. We can set an order once we get all of the plugins in place.
I've broken the plurals issue into a separate - #1929590: Use proper plural form for constraint messages
And yes, that last request is probably too difficult.
Comment #2
bhavin.ahya commentedTo modify the display order of password constraints we can do something like :
search for the function "password_policy_add_policy_js" in password_policy.module file. Then print $policy array and change the order of keys and values.
$policy['policy'] = array
(
);