mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
common.js: Don't set default password quality/length in frontend.
The min quality/length values are always available via data attributes. So there is no point of specefying a default value in common.js.
This commit is contained in:
@@ -32,18 +32,6 @@ var common = require("js/common.js");
|
||||
return self;
|
||||
}());
|
||||
|
||||
password = 'plain';
|
||||
accepted = common.password_quality(password, bar);
|
||||
assert(!accepted);
|
||||
assert.equal(bar.w, '10.654507557627486%');
|
||||
assert.equal(bar.added_class, 'bar-danger');
|
||||
|
||||
password = 'z!X4@S_&';
|
||||
accepted = common.password_quality(password, bar);
|
||||
assert(accepted);
|
||||
assert.equal(bar.w, '47.679074269445294%');
|
||||
assert.equal(bar.added_class, 'bar-success');
|
||||
|
||||
function password_field(min_length, min_quality) {
|
||||
var self = {};
|
||||
|
||||
|
||||
@@ -24,13 +24,8 @@ exports.password_quality = function (password, bar, password_field) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var min_length = 6;
|
||||
var min_quality = 0;
|
||||
|
||||
if (password_field) {
|
||||
min_length = password_field.data('minLength') || min_length;
|
||||
min_quality = password_field.data('minQuality') || min_quality;
|
||||
}
|
||||
var min_length = password_field.data('minLength');
|
||||
var min_quality = password_field.data('minQuality');
|
||||
|
||||
// Consider the password acceptable if it's at least 6 characters.
|
||||
var acceptable = password.length >= min_length;
|
||||
@@ -67,11 +62,7 @@ exports.password_warning = function (password, password_field) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var min_length = 6;
|
||||
|
||||
if (password_field) {
|
||||
min_length = password_field.data('minLength') || min_length;
|
||||
}
|
||||
var min_length = password_field.data('minLength');
|
||||
|
||||
if (password.length < min_length) {
|
||||
return i18n.t('Password should be at least __length__ characters long', {length: min_length});
|
||||
|
||||
Reference in New Issue
Block a user