Skip to content

Commit

Permalink
Set the same max password length for every field
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 2, 2023
1 parent 6e89e0e commit 40ee1ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions routes/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ router.post('/profile', passport.checkLogin, (req, res) => {

spamLevel: Joi.number().empty('').min(0).max(100),

existingPassword: Joi.string().empty('').min(8).max(100).label('Current password'),
password: Joi.string().empty('').min(8).max(100).label('New password').valid(Joi.ref('password2')),
password2: Joi.string().empty('').min(8).max(100).label('Repeat password')
existingPassword: Joi.string().empty('').min(8).max(256).label('Current password'),
password: Joi.string().empty('').min(8).max(256).label('New password').valid(Joi.ref('password2')),
password2: Joi.string().empty('').min(8).max(256).label('Repeat password')
})
.and('password', 'existingPassword', 'password2');

Expand Down Expand Up @@ -504,8 +504,8 @@ router.post('/update-password', (req, res) => {
}

const updateSchema = Joi.object().keys({
password: Joi.string().empty('').min(8).max(100).label('New password').valid(Joi.ref('password2')).required(),
password2: Joi.string().empty('').min(8).max(100).label('Repeat password').required()
password: Joi.string().empty('').min(8).max(256).label('New password').valid(Joi.ref('password2')).required(),
password2: Joi.string().empty('').min(8).max(256).label('Repeat password').required()
});

delete req.body._csrf;
Expand Down
6 changes: 3 additions & 3 deletions routes/account/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ router.post('/password', (req, res) => {
}

const updateSchema = Joi.object().keys({
existingPassword: Joi.string().empty('').min(8).max(100).label('Current password').required(),
password: Joi.string().empty('').min(8).max(100).label('New password').valid(Joi.ref('password2')).required(),
password2: Joi.string().empty('').min(8).max(100).label('Repeat password').required()
existingPassword: Joi.string().empty('').min(8).max(256).label('Current password').required(),
password: Joi.string().empty('').min(8).max(256).label('New password').valid(Joi.ref('password2')).required(),
password2: Joi.string().empty('').min(8).max(256).label('Repeat password').required()
});

delete req.body._csrf;
Expand Down

0 comments on commit 40ee1ef

Please sign in to comment.