-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Moving to single password field for registration #7729
Conversation
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.
Thanks for submitting this @Ari1009! Sorry that this has taken so long to review.
I've left some review notes for this PR. Let me know if you're still interested in finishing this up. If not, I can make any necessary updates to this branch so that your contribution makes it into our codebase.
@@ -28,12 +28,16 @@ <h1>$_("Sign Up")</h1> | |||
<span class="smaller lighter">$input.help</span> | |||
</div> | |||
<div class="input"> | |||
<script src="https://kit.fontawesome.com/a076d05399.js"></script> |
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.
<script src="https://kit.fontawesome.com/a076d05399.js"></script> |
This script tag is being added to the page each time that field
is called in this template. Anyway, we should save a copy of each visibility icon in our images directory.
$:input.render() | ||
$if input.name == 'password': | ||
$:suffix |
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.
$:suffix | |
<span class="password-visibility-toggle password-visibility-toggle--hidden"></span> |
There is no suffix
being passed for the password field. Just render the icon here, instead.
passwordInput.parentNode.appendChild(passwordVisibilityToggle); | ||
}); | ||
</script> | ||
</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.
</div> | |
</div> | |
Add a trailing newline character to the end of this file.
<style> | ||
#password-visibility-toggle { | ||
font-size: 14px; | ||
margin-left: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
</style> |
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.
<style> | |
#password-visibility-toggle { | |
font-size: 14px; | |
margin-left: 5px; | |
cursor: pointer; | |
} | |
</style> |
We try to avoid adding inline styles whenever possible. New rules for the password field should be added to https://github.com/internetarchive/openlibrary/blob/master/static/css/components/form.olform.less
<script> | ||
window.addEventListener("load", function() { | ||
var passwordInput = document.getElementById("password"); | ||
var passwordVisibilityToggle = document.createElement("span"); | ||
passwordVisibilityToggle.id = "password-visibility-toggle"; | ||
passwordVisibilityToggle.innerHTML = '<i class="far fa-eye"></i>'; | ||
passwordVisibilityToggle.addEventListener("click", function(e) { | ||
e.preventDefault(); | ||
if (passwordInput.type === "password") { | ||
passwordInput.type = "text"; | ||
passwordVisibilityToggle.innerHTML = '<i class="far fa-eye-slash"></i>'; | ||
} else { | ||
passwordInput.type = "password"; | ||
passwordVisibilityToggle.innerHTML = '<i class="far fa-eye"></i>'; | ||
} | ||
}); | ||
passwordInput.parentNode.appendChild(passwordVisibilityToggle); | ||
}); | ||
</script> |
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.
<script> | |
window.addEventListener("load", function() { | |
var passwordInput = document.getElementById("password"); | |
var passwordVisibilityToggle = document.createElement("span"); | |
passwordVisibilityToggle.id = "password-visibility-toggle"; | |
passwordVisibilityToggle.innerHTML = '<i class="far fa-eye"></i>'; | |
passwordVisibilityToggle.addEventListener("click", function(e) { | |
e.preventDefault(); | |
if (passwordInput.type === "password") { | |
passwordInput.type = "text"; | |
passwordVisibilityToggle.innerHTML = '<i class="far fa-eye-slash"></i>'; | |
} else { | |
passwordInput.type = "password"; | |
passwordVisibilityToggle.innerHTML = '<i class="far fa-eye"></i>'; | |
} | |
}); | |
passwordInput.parentNode.appendChild(passwordVisibilityToggle); | |
}); | |
</script> |
We try to avoid adding inline Javascript whenever possible. The click handler for the password visibility toggle affordance should probably be in this file, which contains other functions related to account creation:
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #7729 +/- ##
==========================================
- Coverage 16.68% 16.63% -0.05%
==========================================
Files 88 89 +1
Lines 4681 4695 +14
Branches 835 838 +3
==========================================
Hits 781 781
- Misses 3384 3396 +12
- Partials 516 518 +2 ☔ View full report in Codecov by Sentry. |
Somebody other than me needs to review this, as I have added my own commits. |
* Use localized strings * Adjust margin for password inputs --------- Co-authored-by: James Champ <jameschamp@acm.org>
Closes #7645
An button to show and hide password
Technical
Changes in html and a python file. Also used fontawesome eye icon
Testing
docker compose up , then redirect to sign in page.
Screenshot
Before
After
Stakeholders
@beccat123