validate valitity of userpassword when updating it via updateUserInfos

This commit is contained in:
Ulf Gebhardt 2022-03-07 13:31:33 +01:00
parent e0490827c7
commit cc596df22a
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -592,6 +592,13 @@ export class UserResolver {
}
if (password && passwordNew) {
// Validate Password
if (!isPassword(passwordNew)) {
throw new Error(
'Please enter a valid password with at least 8 characters, upper and lower case letters, at least one number and one special character!',
)
}
// TODO: This had some error cases defined - like missing private key. This is no longer checked.
const oldPasswordHash = SecretKeyCryptographyCreateKey(userEntity.email, password)
if (BigInt(userEntity.password.toString()) !== oldPasswordHash[0].readBigUInt64LE()) {