mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
refactor(login-error): (Auth) [PM-22145] Improved Error State for Failed Login (#16569)
Updates the inline error message on a failed login.
This commit is contained in:
@@ -34,6 +34,7 @@ import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/a
|
||||
import { EncString } from "@bitwarden/common/key-management/crypto/models/enc-string";
|
||||
import { KeyConnectorService } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service";
|
||||
import { MasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction";
|
||||
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
|
||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
@@ -369,6 +370,15 @@ export class LoginCommand {
|
||||
|
||||
return await this.handleSuccessResponse(response);
|
||||
} catch (e) {
|
||||
if (
|
||||
e instanceof ErrorResponse &&
|
||||
e.message === "Username or password is incorrect. Try again."
|
||||
) {
|
||||
const env = await firstValueFrom(this.environmentService.environment$);
|
||||
const host = Utils.getHost(env.getWebVaultUrl());
|
||||
return Response.error(this.i18nService.t("invalidMasterPasswordConfirmEmailAndHost", host));
|
||||
}
|
||||
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,15 @@
|
||||
"invalidMasterPassword": {
|
||||
"message": "Invalid master password."
|
||||
},
|
||||
"invalidMasterPasswordConfirmEmailAndHost": {
|
||||
"message": "Invalid master password. Confirm your email is correct and your account was created on $HOST$.",
|
||||
"placeholders": {
|
||||
"host": {
|
||||
"content": "$1",
|
||||
"example": "vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sessionTimeout": {
|
||||
"message": "Your session has timed out. Please go back and try logging in again."
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user