mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-03 22:30:58 +01:00
fix: remove 'password-too-long' error message and all invocations
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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]]');
|
||||
|
||||
@@ -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]]');
|
||||
|
||||
@@ -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);
|
||||
|
||||
11
test/user.js
11
test/user.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user