fix: remove 'password-too-long' error message and all invocations

This commit is contained in:
Julian Lam
2020-11-03 11:42:42 -05:00
parent b235f3b15c
commit 1e312bf7ef
7 changed files with 0 additions and 36 deletions

View File

@@ -43,7 +43,6 @@
"username-too-short": "Username too short",
"username-too-long": "Username too long",
"password-too-long": "Password too long",
"reset-rate-limited": "Too many password reset requests (rate limited)",
"user-banned": "User banned",

View File

@@ -25,8 +25,6 @@ define('forum/account/edit/password', [
passwordvalid = false;
if (password.val().length < ajaxify.data.minimumPasswordLength) {
showError(password_notify, '[[reset_password:password_too_short]]');
} else if (password.val().length > 512) {
showError(password_notify, '[[error:password-too-long]]');
} else if (!utils.isPasswordValid(password.val())) {
showError(password_notify, '[[user:change_password_error]]');
} else if (password.val() === ajaxify.data.username) {

View File

@@ -184,8 +184,6 @@ define('forum/register', [
if (password.length < ajaxify.data.minimumPasswordLength) {
showError(password_notify, '[[reset_password:password_too_short]]');
} else if (password.length > 512) {
showError(password_notify, '[[error:password-too-long]]');
} else if (!utils.isPasswordValid(password)) {
showError(password_notify, '[[user:change_password_error]]');
} else if (password === $('#username').val()) {

View File

@@ -16,9 +16,6 @@ define('forum/reset_code', ['zxcvbn'], function (zxcvbn) {
if (password.val().length < ajaxify.data.minimumPasswordLength) {
$('#notice').removeClass('hidden');
$('#notice strong').translateText('[[reset_password:password_too_short]]');
} else if (password.val().length > 512) {
$('#notice').removeClass('hidden');
$('#notice strong').translateText('[[error:password-too-long]]');
} else if (password.val() !== repeat.val()) {
$('#notice').removeClass('hidden');
$('#notice strong').translateText('[[reset_password:passwords_do_not_match]]');

View File

@@ -169,10 +169,6 @@ module.exports = function (User) {
throw new Error('[[reset_password:password_too_short]]');
}
if (password.length > 512) {
throw new Error('[[error:password-too-long]]');
}
const strength = zxcvbn(password);
if (strength.score < minStrength) {
throw new Error('[[user:weak_password]]');

View File

@@ -316,19 +316,6 @@ describe('authentication', function () {
});
});
it('should fail to login if password is longer than 4096', function (done) {
var longPassword;
for (var i = 0; i < 5000; i++) {
longPassword += 'a';
}
loginUser('someuser', longPassword, function (err, response, body) {
assert.ifError(err);
assert.equal(response.statusCode, 403);
assert.equal(body, '[[error:password-too-long]]');
done();
});
});
it('should fail to login if local login is disabled', function (done) {
privileges.global.rescind(['groups:local:login'], 'registered-users', function (err) {
assert.ifError(err);

View File

@@ -90,17 +90,6 @@ describe('User', function () {
});
});
it('should error with a too long password', function (done) {
var toolong = '';
for (var i = 0; i < 5000; i++) {
toolong += 'a';
}
User.create({ username: 'test', password: toolong }, function (err) {
assert.equal(err.message, '[[error:password-too-long]]');
done();
});
});
it('should error if username is already taken or rename user', async function () {
let err;
async function tryCreate(data) {