Improve password prompt UI

pull/1/head
yflory 5 years ago
parent c9c19b8395
commit 2fd31e8d89

@ -9,8 +9,27 @@
flex: 1; flex: 1;
min-width: 0; min-width: 0;
} }
label, .fa { .fa {
margin-left: 10px; width: 30px;
height: 30px;
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
&:hover {
background-color: rgba(0,0,0,0.1);
}
}
}
.cp-password-change-container {
display: flex;
align-items: center;
.cp-password-container {
margin-bottom: 0 !important;
flex: 1;
}
button {
margin: 0 !important;
} }
} }
} }

@ -590,9 +590,10 @@ define([
}, opts); }, opts);
var input = h('input.cp-password-input', attributes); var input = h('input.cp-password-input', attributes);
var reveal = UI.createCheckbox('cp-password-reveal', Messages.password_show); //var reveal = UI.createCheckbox('cp-password-reveal', Messages.password_show);
var eye = h('span.fa.fa-eye.cp-password-reveal'); var eye = h('span.fa.fa-eye.cp-password-reveal');
/*
$(reveal).find('input').on('change', function () { $(reveal).find('input').on('change', function () {
if($(this).is(':checked')) { if($(this).is(':checked')) {
$(input).prop('type', 'text'); $(input).prop('type', 'text');
@ -602,7 +603,9 @@ define([
$(input).prop('type', 'password'); $(input).prop('type', 'password');
$(input).focus(); $(input).focus();
}); });
*/
if (displayEye) {
$(eye).mousedown(function () { $(eye).mousedown(function () {
$(input).prop('type', 'text'); $(input).prop('type', 'text');
$(input).focus(); $(input).focus();
@ -613,15 +616,28 @@ define([
$(input).prop('type', 'password'); $(input).prop('type', 'password');
$(input).focus(); $(input).focus();
}); });
if (displayEye) { } else {
$(eye).click(function () {
if ($(this).hasClass('fa-eye')) {
$(input).prop('type', 'text');
$(input).focus();
$(this).removeClass('fa-eye').addClass('fa-eye-slash');
return;
}
$(input).prop('type', 'password');
$(input).focus();
$(this).removeClass('fa-eye-slash').addClass('fa-eye');
});
}
/*if (displayEye) {
$(reveal).hide(); $(reveal).hide();
} else { } else {
$(eye).hide(); $(eye).hide();
} }*/
return h('span.cp-password-container', [ return h('span.cp-password-container', [
input, input,
reveal, //reveal,
eye eye
]); ]);
}; };

@ -570,7 +570,7 @@ define([
style: 'flex: 1;' style: 'flex: 1;'
}); });
var passwordOk = h('button', Messages.properties_changePasswordButton); var passwordOk = h('button', Messages.properties_changePasswordButton);
var changePass = h('span.cp-password-container', [ var changePass = h('span.cp-password-change-container', [
newPassword, newPassword,
passwordOk passwordOk
]); ]);

Loading…
Cancel
Save