Skip to content
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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

skrupnyk
Copy link
Contributor

@romanyosyfiv @inna-bieshulia

OD-746 https://weboo.atlassian.net/browse/OD-746

Description

  • A checkbox has been added in the component settings, which allows users to enable or disable this feature.
  • Added an eye icon, which changes the type of input when clicked.

Screenshots/screencasts

www.awesomescreenshot.com/video/7898599?key=90ed6494027bfc18385f94681b92af08

Backward compatibility

This change is fully backward compatible.

Reviewers

@upplabs-alex-levchenko

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">
Copy link
Contributor

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());
Copy link
Contributor

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.

Suggested change
$($(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');
Copy link
Contributor

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.

  1. It should be specific to the widget instance, e.g. $container.find(...) so that each instance can have its separate behaviour.
  2. 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be container specific.

Suggested change
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>
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants