mirror of
https://github.com/bitwarden/jslib
synced 2025-12-19 01:33:22 +00:00
Minor fixes when integrating with web client
This commit is contained in:
@@ -113,11 +113,10 @@ import { ValidationService } from "./validation.service";
|
||||
PlatformUtilsServiceAbstraction,
|
||||
MessagingServiceAbstraction,
|
||||
LogService,
|
||||
CryptoFunctionServiceAbstraction,
|
||||
KeyConnectorServiceAbstraction,
|
||||
EnvironmentServiceAbstraction,
|
||||
TwoFactorServiceAbstraction,
|
||||
StateServiceAbstraction,
|
||||
TwoFactorServiceAbstraction,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -430,6 +429,7 @@ import { ValidationService } from "./validation.service";
|
||||
TokenServiceAbstraction,
|
||||
LogService,
|
||||
OrganizationServiceAbstraction,
|
||||
CryptoFunctionServiceAbstraction,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,6 +3,8 @@ import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
||||
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequest";
|
||||
|
||||
export abstract class AuthService {
|
||||
masterPasswordHash: string;
|
||||
email: string;
|
||||
logIn: (
|
||||
email: string,
|
||||
masterPassword: string,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
||||
|
||||
export abstract class TwoFactorService {
|
||||
init: () => void;
|
||||
getSupportedProviders: (win: Window) => any[];
|
||||
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
||||
clearSelectedProvider: () => void;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Utils } from "../../../misc/utils";
|
||||
export class PasswordTokenRequest extends TokenRequest implements CaptchaProtectedRequest {
|
||||
constructor(
|
||||
public email: string,
|
||||
private masterPasswordHash: string,
|
||||
public masterPasswordHash: string,
|
||||
public captchaResponse: string,
|
||||
protected twoFactor: TokenRequestTwoFactor,
|
||||
device?: DeviceRequest
|
||||
|
||||
@@ -219,6 +219,14 @@ export class AuthService implements AuthServiceAbstraction {
|
||||
return this.savedTokenRequest instanceof PasswordTokenRequest;
|
||||
}
|
||||
|
||||
get email(): string {
|
||||
return (this.savedTokenRequest as PasswordTokenRequest).email;
|
||||
}
|
||||
|
||||
get masterPasswordHash(): string {
|
||||
return (this.savedTokenRequest as PasswordTokenRequest).masterPasswordHash;
|
||||
}
|
||||
|
||||
async makePreloginKey(masterPassword: string, email: string): Promise<SymmetricCryptoKey> {
|
||||
email = email.trim().toLowerCase();
|
||||
let kdf: KdfType = null;
|
||||
@@ -259,7 +267,7 @@ export class AuthService implements AuthServiceAbstraction {
|
||||
result.resetMasterPassword = tokenResponse.resetMasterPassword;
|
||||
result.forcePasswordReset = tokenResponse.forcePasswordReset;
|
||||
|
||||
this.saveAccountInformation(tokenResponse);
|
||||
await this.saveAccountInformation(tokenResponse);
|
||||
|
||||
if (tokenResponse.twoFactorToken != null) {
|
||||
await this.tokenService.setTwoFactorToken(tokenResponse.twoFactorToken);
|
||||
|
||||
Reference in New Issue
Block a user