mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
* Revert "Revert "Minimum password length + Static Pages fixes (#11474)""
This reverts commit d1afbf4b92.
* add min length for reset password
This commit is contained in:
@@ -189,6 +189,28 @@ describe('POST /user/auth/reset-password-set-new-one', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('renders the error page if the password is too short', async () => {
|
||||
const user = await generateUser();
|
||||
|
||||
const code = encrypt(JSON.stringify({
|
||||
userId: user._id,
|
||||
expiresAt: moment().add({ days: 1 }),
|
||||
}));
|
||||
await user.update({
|
||||
'auth.local.passwordResetCode': code,
|
||||
});
|
||||
|
||||
await expect(api.post(`${endpoint}`, {
|
||||
newPassword: 'short',
|
||||
confirmPassword: 'short',
|
||||
code,
|
||||
})).to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('invalidReqParams'),
|
||||
});
|
||||
});
|
||||
|
||||
it('renders the success page and save the user', async () => {
|
||||
const user = await generateUser();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user