[SG-699] No Error Displayed if SSO Required (#3865)

* Introduced error handling when SSO authentication is required

* Fixed comments from PR
This commit is contained in:
Gbubemi Smith 2022-10-21 15:03:14 -04:00 committed by GitHub
parent 87ddf61540
commit 67c4e34669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -14,13 +14,14 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { StateService } from "@bitwarden/common/abstractions/state.service";
import { ValidationService } from "@bitwarden/common/abstractions/validation.service";
import { AuthRequestType } from "@bitwarden/common/enums/authRequestType";
import { Utils } from "@bitwarden/common/misc/utils";
import { PasswordlessLogInCredentials } from "@bitwarden/common/models/domain/log-in-credentials";
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetric-crypto-key";
import { PasswordlessCreateAuthRequest } from "@bitwarden/common/models/request/passwordless-create-auth.request";
import { AuthRequestResponse } from "@bitwarden/common/models/response/auth-request.response";
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
@Component({
selector: "app-login-with-device",
@ -53,11 +54,11 @@ export class LoginWithDeviceComponent
private apiService: ApiService,
private authService: AuthService,
private logService: LogService,
private stateService: StateService,
environmentService: EnvironmentService,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService,
private anonymousHubService: AnonymousHubService
private anonymousHubService: AnonymousHubService,
private validationService: ValidationService
) {
super(environmentService, i18nService, platformUtilsService);
@ -146,6 +147,12 @@ export class LoginWithDeviceComponent
}
}
} catch (error) {
if (error instanceof ErrorResponse) {
this.router.navigate(["/login"]);
this.validationService.showError(error);
return;
}
this.logService.error(error);
}
}