1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-06 02:23:14 +00:00

Move LogIn specific logic to entry method

This commit is contained in:
Thomas Rittson
2021-12-20 10:35:47 +10:00
parent 2551da6592
commit 30d3a14524

View File

@@ -105,6 +105,9 @@ export class AuthService implements AuthServiceAbstraction {
if (result.twoFactor) {
this.saveState(tokenRequest, result.twoFactorProviders, localHashedPassword, key);
} else if (this.setCryptoKeys) {
await this.cryptoService.setKey(key);
await this.cryptoService.setKeyHash(localHashedPassword);
}
return result;
@@ -206,7 +209,7 @@ export class AuthService implements AuthServiceAbstraction {
return await this.logInSso(null, null, null, null);
}
throw new Error("Error: Could not find login in progress.");
throw new Error("Error: Could not find stored login state.");
}
logOut(callback: Function) {
@@ -278,13 +281,6 @@ export class AuthService implements AuthServiceAbstraction {
}
if (this.setCryptoKeys) {
if (key != null) {
await this.cryptoService.setKey(key);
}
if (localHashedPassword != null) {
await this.cryptoService.setKeyHash(localHashedPassword);
}
if (!this.isNewSsoUser(code, tokenResponse.key)) {
if (tokenResponse.keyConnectorUrl != null) {
await this.keyConnectorService.getAndSetKey(tokenResponse.keyConnectorUrl);