-
Notifications
You must be signed in to change notification settings - Fork 13
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
OD-746 [Feature] Added show password function #98
base: master
Are you sure you want to change the base?
Conversation
build.html
Outdated
@@ -77,8 +78,14 @@ | |||
<form class="form-horizontal form-reset-password"> | |||
<p class="instruction">Enter your new password below.</p> | |||
<div class="input-wrapper"> | |||
<input type="password" class="form-control new-password focus-outline" placeholder="Enter your new password" autocomplete="new-password" /> | |||
<input type="password" class="form-control confirm-password focus-outline" placeholder="Confirm your new password" autocomplete="new-password" /> | |||
<div class="col-sm-12 fl-new-password"> |
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.
Why use a Bootstrap specific col-sm-12
class only to add padding-left: 0
and padding-right: 0
in CSS? It feels like we could just use a <div>
without any Bootstrap class and avoid the padding overrides in CSS.
Though you might need to add position: relative
.
js/build.js
Outdated
@@ -284,6 +285,16 @@ Fliplet.Widget.instance('login-ds', function(data) { | |||
} | |||
}); | |||
|
|||
$passwordInputs.on('input', function(event) { | |||
$($(event.target).next('.fa-eye')).toggleClass('invisible', !data.showPassword || !$(event.target).val()); |
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.
I don't think the extra $()
wrapper is necessary.
$($(event.target).next('.fa-eye')).toggleClass('invisible', !data.showPassword || !$(event.target).val()); | |
$(event.target).next('.fa-eye').toggleClass('invisible', !data.showPassword || !$(event.target).val()); |
js/build.js
Outdated
@@ -1,6 +1,8 @@ | |||
Fliplet.Widget.instance('login-ds', function(data) { | |||
var $container = $(this); | |||
|
|||
var $passwordInputs = $('.profile_password, .new-password, .confirm-password'); |
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.
This suggests that all the password visibilities on the page are being controlled in one go. There are 2 problems with this.
- It should be specific to the widget instance, e.g.
$container.find(...)
so that each instance can have its separate behaviour. - https://weboo.atlassian.net/browse/OD-746?focusedCommentId=27859 suggests that we don't want them all to be toggled together.
js/build.js
Outdated
@@ -1,6 +1,8 @@ | |||
Fliplet.Widget.instance('login-ds', function(data) { | |||
var $container = $(this); | |||
|
|||
var $passwordInputs = $('.profile_password, .new-password, .confirm-password'); | |||
var $showPasswordButtons = $('.fa-eye'); |
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.
Should be container specific.
var $showPasswordButtons = $('.fa-eye'); | |
var $showPasswordButtons = $container.find('.fa-eye'); |
build.html
Outdated
@@ -16,6 +16,7 @@ | |||
<div class="form-group clearfix"> | |||
<div class="col-sm-12 fl-password"> | |||
<input type="password" class="form-control profile_password focus-outline" name="Password" placeholder="Enter your password" autocomplete="new-password" /> | |||
<i class="fa fa-eye invisible"></i> |
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.
Why have we chosen to use invisible
instead of hidden
? When invisible
is used, it's still on the page and visible to screen readers. I don't see why we'd need to do that.
@romanyosyfiv @inna-bieshulia
OD-746 https://weboo.atlassian.net/browse/OD-746
Description
Screenshots/screencasts
www.awesomescreenshot.com/video/7898599?key=90ed6494027bfc18385f94681b92af08
Backward compatibility
This change is fully backward compatible.
Reviewers
@upplabs-alex-levchenko