-
Notifications
You must be signed in to change notification settings - Fork 1k
Added password strength gauge in registration form. #2542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In order to follow the zxcvbn recommendations I made some changes on the frontend pipeline, specifically creating a The UI is of course up for discussion and there's no validation step, it's simply a graphical representation of the result of zxcvbn score, any comments and suggestions are appreciated. |
@yeraydiazdiaz This is great, thanks! I think vendoring the library is definitely the right approach. We do something similar for the Admin UI.
The UI looks great to me but @nlhkabu will have to approve. We do validate this in the backend (the score must be >= 2) so it would be reasonable to disable form submission if the password doesn't meet this score. |
Cool, I didn't realise we were doing it already. I'll add the disabling of the submit button for low scores to this PR and wait for feedback on the UI. |
4fac9c9
to
3198ecc
Compare
The gif of this change looks really good to me, I'll try to get it reviewed this week and if @nlhkabu hasn't had a chance to review it before then, I feel comfortable merging it and tagging it for her to do a post-commit review. |
@yeraydiazdiaz After taking a second look at this, I think that I wasn't clear enough when I said " it would be reasonable to disable form submission". What I meant was that attempting to submit the form when the password doesn't meet these requirements should not submit the form, and instead show a tooltip indicating that the password is insufficient, similar to how it works for other fields: By disabling the submit button, the form no longer gives this feedback when a non-password field is invalid, which is not a great UX. |
@di I agree it's not great UX. I did consider adding information via the tooltip, however it is actually implemented using the I do think disabling the submit button if the required fields are missing helps the UX though, if you agree maybe the easiest way forward is to show a message and/or color code the guage to show that the password is not secure enough? |
bde4cb8
to
6df092a
Compare
I've repurposed this PR implementing the behaviour described by @di. I had to build a custom tooltip system in a similar fashion to that of Chrome but I think the flow is now quite nice. Here's the result: |
6df092a
to
a3bfd0c
Compare
Huh, didn't realise the above gif shows a backend validation error on the password strength while the frontend allows submission. I must have had local changes in the backend. Here's the actual flow: Currently tooltips are only cleared when attempting another form submission. I am wondering if they should disappear after a timeout, an event (maybe when focusing on the infringing or any field in the form) or both? It'd be good to introduce some testing around frontend, not sure if there's plans for that. |
148c0d6
to
b449374
Compare
a67c09f
to
f07b6f8
Compare
Thanks for your PR @yeraydiazdiaz and sorry for the slow response! The folks working on Warehouse have gotten funding to concentrate on improving and deploying Warehouse, and have kicked off work towards our development roadmap. Issue #6 is in our "shut down Legacy PyPI" milestone which we might not get to during the next few months of grant-funded effort, but we are working to review open PRs while we have multiple maintainers concentrating on improving Warehouse right now. So if you fix the merge conflict on this PR and let us know that you've done so by leaving a comment, the next few months are a good time to get it re-reviewed. Thanks and sorry again for the wait. |
f38ca6c
to
bfd1caf
Compare
Hi @brainwane, no worries, I've rebased and updated the PR, let me know if it needs any changes. |
@lgh2 the next time you and I chat in IRC, let's talk about you reviewing this PR. Thanks! |
Sounds good! |
Hi @yeraydiazdiaz -- thank you very much for the PR! I am using Chrome Version 64.0.3282.119 (Official Build) beta (64-bit) on Linux Mint 18.1 (Ubuntu Xenial 16.04) I tested it and when I entered "12345678" as a password, the tooltip appeared up at the top of the screen, and I had to scroll up in order to see it: Since I block ads pretty aggressively in Chrome, Sumana suggested that some of my plugins might be causing the issue, so I created a new profile in Chrome for testing, and had the same problem: The form did not submit when the "password strength" bar was red or orange, but would submit when it was yellow or green. I think moving the tooltip to a more visible place might help users see why the form is not submitting. |
@nlhkabu I've implemented your suggestions, in particular using the existing tooltip system which I somehow managed completely miss before 😅 |
@yeraydiazdiaz This looks great! One small change before merging: The "Confirm Password" input is starting to look a little out of place with everything between it and the "Password" input. Could you change the class for it's label from |
2492f8a
to
c872120
Compare
</div> | ||
*/ | ||
|
||
.password-strength { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect :)
Password strength: <span class="password-strength"><span class="password-strength__guage"></span></span> | ||
</p> | ||
</div> | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not document the containing block here. The following is enough:
<span class="password-strength">
<span class="password-strength__guage"></span>
</span>
Hi @yeraydiazdiaz and @di, I've just added a couple of nitpick comments. One thing we're not considering here is the experience of users who are using screen readers.
If this is too much to include in this PR, we can merge without and open a separate ticket and PR later? |
<p class="form-group__help-text"> | ||
Choose a strong password that contains letters (uppercase and lowercase), numbers and special characters. Avoid common words or repetition. | ||
Password strength: <span class="password-strength"><span class="password-strength__guage"></span></span> | ||
</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we split this out into 2 <p>
s?
<p class="form-group__help-text">
Choose a strong password that contains letters (uppercase and lowercase), numbers and special characters. Avoid common words or repetition.
</p>
<p class="form-group__help-text">
<strong>Password strength</strong>
<span class="password-strength">
<span class="password-strength__guage"></span>
</span>
</p>
@nlhkabu We are setting the |
c872120
to
06c93e6
Compare
@di, I think we should do both. The experience for someone using a screen reader will be to hear "password strength" and then ... nothing. Adding something here to indicate the strength before they submit the form would be useful :) |
Include it in the register template Added password strength gauge in registration form.
Ignore vendor scripts in lint.
Adapt to naming convention. Use existing tooltips.
06c93e6
to
9147f0a
Compare
Thanks @yeraydiazdiaz! |
Thank you so much, @yeraydiazdiaz! Let us know if you're interested in an idea for the next issue you could work on. :) |
No worries at all, I tried out pypi.org last night and it was an excellent experience, really happy to contribute, just point me to an issue 👍 |
hi @yeraydiazdiaz - I was actually thinking about this this morning - it would be great if we could add the password strength indicator onto 2 other pages:
What do you think? |
Fixes #6
Added vendor JS gulp step to include zxcvbn.js and include it in the register template.
Added password strength gauge in registration form.