Only check existense of user password when using password auth

Fixes #3831
This commit is contained in:
rijkvanzanten
2021-01-28 11:52:59 -05:00
parent 52948bcbce
commit 5632bd0ea7

View File

@@ -46,12 +46,14 @@ export class AuthenticationService {
throw new InvalidCredentialsException();
}
if (!password || !user.password) {
throw new InvalidCredentialsException();
}
if (password !== undefined) {
if (!user.password) {
throw new InvalidCredentialsException();
}
if (password !== undefined && (await argon2.verify(user.password, password)) === false) {
throw new InvalidCredentialsException();
if ((await argon2.verify(user.password, password)) === false) {
throw new InvalidCredentialsException();
}
}
if (user.tfa_secret && !otp) {