summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/system/system.css26
-rw-r--r--modules/user/user.js24
-rw-r--r--modules/user/user.module4
3 files changed, 42 insertions, 12 deletions
diff --git a/modules/system/system.css b/modules/system/system.css
index acfc50716..3e416470b 100644
--- a/modules/system/system.css
+++ b/modules/system/system.css
@@ -520,15 +520,22 @@ html.js .js-hide {
/*
** Password strength indicator
*/
+#password-strength {
+ width: 17em;
+ float: right; /* LTR */
+ margin-top: 1.4em;
+}
.password-strength-title {
- float: left; /* LTR */
+ display: inline;
+}
+#password-strength-text {
+ float: right; /* LTR */
+ font-weight: bold;
}
#password-indicator {
- border: 1px solid #B4B4B4;
- float: right;
- height: 0.9em;
- margin: 0.3em 0.80em 0 0.3em;
- width: 5em;
+ background-color: #C4C4C4;
+ height: 0.3em;
+ width: 100%;
}
#password-indicator div {
height: 100%;
@@ -539,6 +546,10 @@ input.password-confirm, input.password-field {
width: 16em;
margin-bottom: 0.4em;
}
+div.password-confirm {
+ display: inline;
+ padding-left: 1em;
+}
div.password-suggestions {
padding: 0.2em 0.5em;
margin: 0.7em 0;
@@ -550,8 +561,7 @@ div.password-suggestions ul {
}
.password-parent {
margin: 0;
- float: left; /* LTR */
- width: 17.3em;
+ width: 34.3em;
}
/*
diff --git a/modules/user/user.js b/modules/user/user.js
index d382375ab..52279db67 100644
--- a/modules/user/user.js
+++ b/modules/user/user.js
@@ -18,10 +18,11 @@ Drupal.behaviors.password = {
var passwordResult = $('span.password-result', passwordStrength);
innerWrapper.addClass('password-parent');
- // Add the description box at the end.
- var passwordMeter = '<div id="password-strength"><div class="password-strength-title">' + translate.strengthTitle + '</div><div id="password-indicator"><div id="indicator"></div></div></div>';
+ // Add the description box.
+ var passwordMeter = '<div id="password-strength"><div id="password-strength-text"></div><div class="password-strength-title">' + translate.strengthTitle + '</div><div id="password-indicator"><div id="indicator"></div></div></div>';
+
$('div.description', outerWrapper).prepend('<div class="password-suggestions"></div>');
- $(innerWrapper).append(passwordMeter);
+ $(innerWrapper).prepend(passwordMeter);
var passwordDescription = $('div.password-suggestions', outerWrapper).hide();
// Add the password confirmation layer.
@@ -52,6 +53,9 @@ Drupal.behaviors.password = {
// Adjust the length of the strength indicator.
$('#indicator').css('width', result.strength + '%');
+ // Update the strength indication text.
+ $("#password-strength-text").html(result.indicatorText);
+
passwordCheckMatch();
};
@@ -155,9 +159,21 @@ Drupal.evaluatePasswordStrength = function (password, translate) {
strength = 5;
}
+ // Based on the strength, work out what text should be shown by the password strength meter.
+ if (strength < 60) {
+ indicatorText = translate.weak;
+ } else if (strength < 70) {
+ indicatorText = translate.fair;
+ } else if (strength < 80) {
+ indicatorText = translate.good;
+ } else if (strength < 100) {
+ indicatorText = translate.strong;
+ }
+
// Assemble the final message.
msg = translate.hasWeaknesses + '<ul><li>' + msg.join('</li><li>') + '</li></ul>';
- return { strength: strength, message: msg };
+ return { strength: strength, message: msg, indicatorText: indicatorText }
+
};
/**
diff --git a/modules/user/user.module b/modules/user/user.module
index cf41f9d7e..a57965202 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2877,6 +2877,10 @@ function _user_password_dynamic_validation() {
'sameAsUsername' => t('Make it different from your username'),
'confirmSuccess' => t('yes'),
'confirmFailure' => t('no'),
+ 'weak' => t('Weak'),
+ 'fair' => t('Fair'),
+ 'good' => t('Good'),
+ 'strong' => t('Strong'),
'confirmTitle' => t('Passwords match:'),
'username' => (isset($user->name) ? $user->name : ''))),
'setting');