Standardize response codes in Login (#6787)

* standardizing login response codes

* playwright fix

* added translation
This commit is contained in:
Syed Ali Shahbaz authored and GitHub committed 2023-01-30 18:37:03 +00:00
1 parent 1be6f192d4
commit a4bed48eaf
5 files changed
+11 -8

No files matched your search

+4 -3
View File
@@ -72,8 +72,9 @@ const providers: Provider[] = [
},
});
// Don't leak information about it being username or password that is invalid
if (!user) {
throw new Error(ErrorCode.UserNotFound);
throw new Error(ErrorCode.IncorrectUsernamePassword);
}
if (user.identityProvider !== IdentityProvider.CAL) {
@@ -81,12 +82,12 @@ const providers: Provider[] = [
}
if (!user.password) {
throw new Error(ErrorCode.UserMissingPassword);
throw new Error(ErrorCode.IncorrectUsernamePassword);
}
const isCorrectPassword = await verifyPassword(credentials.password, user.password);
if (!isCorrectPassword) {
throw new Error(ErrorCode.IncorrectPassword);
throw new Error(ErrorCode.IncorrectUsernamePassword);
}
if (user.twoFactorEnabled) {