mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 23:19:10 +00:00
Color the password strength bar red or green
(imported from commit 6b3fa7d3565a7e4f61a952fc26e1e9e564d894f9)
This commit is contained in:
@@ -19,7 +19,9 @@ function password_quality(password, bar) {
|
||||
if (typeof zxcvbn === 'undefined')
|
||||
return undefined;
|
||||
|
||||
var quality, result = zxcvbn(password);
|
||||
var result = zxcvbn(password);
|
||||
var acceptable = result.crack_time >= 1e5;
|
||||
var quality;
|
||||
|
||||
if (bar !== undefined) {
|
||||
// Compute a quality score in [0,1].
|
||||
@@ -28,8 +30,10 @@ function password_quality(password, bar) {
|
||||
// Display the password quality score on a progress bar
|
||||
// which bottoms out at 10% so there's always something
|
||||
// for the user to see.
|
||||
bar.width(((90 * quality) + 10) + '%');
|
||||
bar.width(((90 * quality) + 10) + '%')
|
||||
.removeClass('bar-success bar-danger')
|
||||
.addClass(acceptable ? 'bar-success' : 'bar-danger');
|
||||
}
|
||||
|
||||
return result.crack_time >= 1e5;
|
||||
return acceptable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user