mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-08 02:10:24 +00:00
change check password strength style (#6719)
* 03 confirm password not check Confirm password input don't check password strength * change change password error style * 02 change password check event and no password state * 01 change arrow style and format css
This commit is contained in:
@@ -65,6 +65,8 @@ const PasswordInput = ({ value, labelValue, enableCheckStrength, onChangeValue }
|
|||||||
|
|
||||||
PasswordInput.propTypes = propTypes;
|
PasswordInput.propTypes = propTypes;
|
||||||
|
|
||||||
PasswordInput.defaultProps = { enableCheckStrength: true };
|
PasswordInput.defaultProps = {
|
||||||
|
enableCheckStrength: true
|
||||||
|
};
|
||||||
|
|
||||||
export default PasswordInput;
|
export default PasswordInput;
|
||||||
|
@@ -62,6 +62,7 @@ const UserSetPassword = ({ toggle }) => {
|
|||||||
value={confirmedPassword}
|
value={confirmedPassword}
|
||||||
labelValue={gettext('Confirm password')}
|
labelValue={gettext('Confirm password')}
|
||||||
onChangeValue={setConfirmedPassword}
|
onChangeValue={setConfirmedPassword}
|
||||||
|
enableCheckStrength={false}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
{errorMessage && (
|
{errorMessage && (
|
||||||
|
@@ -74,6 +74,7 @@ const UserUpdatePassword = ({ toggle }) => {
|
|||||||
value={confirmedNewPassword}
|
value={confirmedNewPassword}
|
||||||
labelValue={gettext('Confirm password')}
|
labelValue={gettext('Confirm password')}
|
||||||
onChangeValue={setConfirmedNewPassword}
|
onChangeValue={setConfirmedNewPassword}
|
||||||
|
enableCheckStrength={false}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
{errorMessage && (
|
{errorMessage && (
|
||||||
|
3090
media/css/seahub.css
3090
media/css/seahub.css
File diff suppressed because it is too large
Load Diff
@@ -93,9 +93,7 @@ $('#signup-form').on('submit', function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(function () {
|
$(function () {
|
||||||
// Assuming passwd_tip and template are defined somewhere in your script.
|
|
||||||
setupPasswordField("password1", passwd_tip, template);
|
setupPasswordField("password1", passwd_tip, template);
|
||||||
setupPasswordField("password2", passwd_tip, template);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -37,9 +37,7 @@ $('.new-narrow-panel').removeClass('vh');
|
|||||||
{% include "snippets/password_strength_js.html" %}
|
{% include "snippets/password_strength_js.html" %}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
// Assuming passwd_tip and template are defined somewhere in your script.
|
|
||||||
setupPasswordField("id_new_password1", passwd_tip, template);
|
setupPasswordField("id_new_password1", passwd_tip, template);
|
||||||
setupPasswordField("id_new_password2", passwd_tip, template);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('form').on('submit', function(){
|
$('form').on('submit', function(){
|
||||||
|
@@ -45,9 +45,7 @@
|
|||||||
$('[type="password"]').addClass('input');
|
$('[type="password"]').addClass('input');
|
||||||
{% include "snippets/password_strength_js.html" %}
|
{% include "snippets/password_strength_js.html" %}
|
||||||
$(function () {
|
$(function () {
|
||||||
// Assuming passwd_tip and template are defined somewhere in your script.
|
|
||||||
setupPasswordField("id_new_password1", passwd_tip, template);
|
setupPasswordField("id_new_password1", passwd_tip, template);
|
||||||
setupPasswordField("id_new_password2", passwd_tip, template);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#signup-form').on('submit', function(){
|
$('#signup-form').on('submit', function(){
|
||||||
|
@@ -40,9 +40,7 @@ $('.new-narrow-panel').removeClass('vh');
|
|||||||
{% include "snippets/password_strength_js.html" %}
|
{% include "snippets/password_strength_js.html" %}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
// Assuming passwd_tip and template are defined somewhere in your script.
|
|
||||||
setupPasswordField("id_new_password1", passwd_tip, template);
|
setupPasswordField("id_new_password1", passwd_tip, template);
|
||||||
setupPasswordField("id_new_password2", passwd_tip, template);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('form').on('submit', function(){
|
$('form').on('submit', function(){
|
||||||
|
@@ -67,9 +67,7 @@
|
|||||||
{% include "snippets/password_strength_js.html" %}
|
{% include "snippets/password_strength_js.html" %}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
// Assuming passwd_tip and template are defined somewhere in your script.
|
|
||||||
setupPasswordField("id_password1", passwd_tip, template);
|
setupPasswordField("id_password1", passwd_tip, template);
|
||||||
setupPasswordField("id_password2", passwd_tip, template);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ var template = `
|
|||||||
<div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25"></div>
|
<div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="popover-content">{% trans "The password should contain different types of characters to make it strong: uppercase letters, lowercase letters, numbers and special characters." %}</div>
|
<div class="popover-content">{% trans "The password should contain different types of characters to make it strong: uppercase letters, lowercase letters, numbers and special characters." %}</div>
|
||||||
|
<div class="arrow"></div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -30,12 +31,23 @@ function setupPasswordField(selector, passwdTip, baseTemplate) {
|
|||||||
template: template,
|
template: template,
|
||||||
trigger: 'focus',
|
trigger: 'focus',
|
||||||
});
|
});
|
||||||
element.addEventListener('keyup', () => {
|
function check() {
|
||||||
var pwd = element.value;
|
var pwd = element.value;
|
||||||
if (pwd.trim()) {
|
if (pwd) {
|
||||||
var level = strengthLevelMap[evaluatePasswordStrength(pwd.trim())];
|
var level = strengthLevelMap[evaluatePasswordStrength(pwd.trim())];
|
||||||
showStrength(level);
|
showStrength(level);
|
||||||
|
} else {
|
||||||
|
showStrength(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
element.addEventListener('keyup', () => {
|
||||||
|
check();
|
||||||
|
});
|
||||||
|
element.addEventListener('focus', () => {
|
||||||
|
// make sure popover open first, then check password strength level
|
||||||
|
setTimeout(() => {
|
||||||
|
check();
|
||||||
|
}, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user