1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

[deps] Autofill: Update prettier to v3 (#7014)

* [deps] Autofill: Update prettier to v3

* prettier formatting updates

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
renovate[bot]
2023-11-29 16:15:20 -05:00
committed by GitHub
parent 4ff5f38e89
commit 28de9439be
1145 changed files with 5898 additions and 5612 deletions

View File

@@ -87,7 +87,7 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
protected validationService: ValidationService,
protected deviceTrustCryptoService: DeviceTrustCryptoServiceAbstraction,
protected platformUtilsService: PlatformUtilsService,
protected passwordResetEnrollmentService: PasswordResetEnrollmentServiceAbstraction
protected passwordResetEnrollmentService: PasswordResetEnrollmentServiceAbstraction,
) {}
async ngOnInit() {
@@ -152,16 +152,16 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
this.rememberDevice.valueChanges
.pipe(
switchMap((value) =>
defer(() => this.deviceTrustCryptoService.setShouldTrustDevice(value))
defer(() => this.deviceTrustCryptoService.setShouldTrustDevice(value)),
),
takeUntil(this.destroy$)
takeUntil(this.destroy$),
)
.subscribe();
}
async loadNewUserData() {
const autoEnrollStatus$ = defer(() =>
this.stateService.getUserSsoOrganizationIdentifier()
this.stateService.getUserSsoOrganizationIdentifier(),
).pipe(
switchMap((organizationIdentifier) => {
if (organizationIdentifier == undefined) {
@@ -173,7 +173,7 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
catchError((err: unknown) => {
this.validationService.showError(err);
return of(undefined);
})
}),
);
const email$ = from(this.stateService.getEmail()).pipe(
@@ -181,7 +181,7 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
this.validationService.showError(err);
return of(undefined);
}),
takeUntil(this.destroy$)
takeUntil(this.destroy$),
);
const autoEnrollStatus = await firstValueFrom(autoEnrollStatus$);
@@ -199,7 +199,7 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
this.validationService.showError(err);
return of(undefined);
}),
takeUntil(this.destroy$)
takeUntil(this.destroy$),
);
email$
@@ -207,7 +207,7 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
takeUntil(this.destroy$),
finalize(() => {
this.loading = false;
})
}),
)
.subscribe((email) => {
const showApproveFromOtherDeviceBtn =
@@ -264,7 +264,7 @@ export class BaseLoginDecryptionOptionsComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("accountSuccessfullyCreated")
this.i18nService.t("accountSuccessfullyCreated"),
);
await this.passwordResetEnrollmentService.enroll(this.data.organizationId);

View File

@@ -23,7 +23,7 @@ export class BaseLoginViaWebAuthnComponent implements OnInit {
private router: Router,
private logService: LogService,
private validationService: ValidationService,
private i18nService: I18nService
private i18nService: I18nService,
) {}
ngOnInit(): void {
@@ -50,7 +50,7 @@ export class BaseLoginViaWebAuthnComponent implements OnInit {
if (authResult.requiresTwoFactor) {
this.validationService.showError(
this.i18nService.t("twoFactorForPasskeysNotSupportedOnClientUpdateToLogIn")
this.i18nService.t("twoFactorForPasskeysNotSupportedOnClientUpdateToLogIn"),
);
this.currentState = "assertFailed";
} else if (authResult.forcePasswordReset == ForceSetPasswordReason.AdminForcePasswordReset) {

View File

@@ -15,7 +15,7 @@ export abstract class CaptchaProtectedComponent {
constructor(
protected environmentService: EnvironmentService,
protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService
protected platformUtilsService: PlatformUtilsService,
) {}
async setupCaptcha() {
@@ -33,7 +33,7 @@ export abstract class CaptchaProtectedComponent {
},
(info: string) => {
this.platformUtilsService.showToast("info", this.i18nService.t("info"), info);
}
},
);
}

View File

@@ -44,7 +44,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
protected platformUtilsService: PlatformUtilsService,
protected policyService: PolicyService,
protected stateService: StateService,
protected dialogService: DialogService
protected dialogService: DialogService,
) {}
async ngOnInit() {
@@ -54,7 +54,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.destroy$))
.subscribe(
(enforcedPasswordPolicyOptions) =>
(this.enforcedPolicyOptions ??= enforcedPasswordPolicyOptions)
(this.enforcedPolicyOptions ??= enforcedPasswordPolicyOptions),
);
}
@@ -85,11 +85,11 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
this.masterPassword,
email.trim().toLowerCase(),
this.kdf,
this.kdfConfig
this.kdfConfig,
);
const newMasterKeyHash = await this.cryptoService.hashMasterKey(
this.masterPassword,
newMasterKey
newMasterKey,
);
let newProtectedUserKey: [UserKey, EncString] = null;
@@ -112,7 +112,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
async performSubmitActions(
newMasterKeyHash: string,
newMasterKey: MasterKey,
newUserKey: [UserKey, EncString]
newUserKey: [UserKey, EncString],
) {
// Override in sub-class
}
@@ -122,7 +122,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("masterPasswordRequired")
this.i18nService.t("masterPasswordRequired"),
);
return false;
}
@@ -130,7 +130,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("masterPasswordMinimumlength", this.minimumLength)
this.i18nService.t("masterPasswordMinimumlength", this.minimumLength),
);
return false;
}
@@ -138,7 +138,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("masterPassDoesntMatch")
this.i18nService.t("masterPassDoesntMatch"),
);
return false;
}
@@ -150,13 +150,13 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
!this.policyService.evaluateMasterPassword(
strengthResult.score,
this.masterPassword,
this.enforcedPolicyOptions
this.enforcedPolicyOptions,
)
) {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("masterPasswordPolicyRequirementsNotMet")
this.i18nService.t("masterPasswordPolicyRequirementsNotMet"),
);
return false;
}

View File

@@ -19,7 +19,7 @@ import {
"void",
style({
opacity: 0,
})
}),
),
transition(
"void => open",
@@ -27,8 +27,8 @@ import {
"100ms linear",
style({
opacity: 1,
})
)
}),
),
),
transition("* => void", animate("100ms linear", style({ opacity: 0 }))),
]),
@@ -53,7 +53,7 @@ export class EnvironmentSelectorComponent implements OnInit, OnDestroy {
constructor(
protected environmentService: EnvironmentServiceAbstraction,
protected configService: ConfigServiceAbstraction,
protected router: Router
protected router: Router,
) {}
async ngOnInit() {

View File

@@ -25,7 +25,7 @@ export class EnvironmentComponent {
protected platformUtilsService: PlatformUtilsService,
protected environmentService: EnvironmentService,
protected i18nService: I18nService,
private modalService: ModalService
private modalService: ModalService,
) {
const urls = this.environmentService.getUrls();
if (this.environmentService.selectedRegion != Region.SelfHosted) {

View File

@@ -22,7 +22,7 @@ export class HintComponent implements OnInit {
protected apiService: ApiService,
protected platformUtilsService: PlatformUtilsService,
private logService: LogService,
private loginService: LoginService
private loginService: LoginService,
) {}
ngOnInit(): void {
@@ -34,7 +34,7 @@ export class HintComponent implements OnInit {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("emailRequired")
this.i18nService.t("emailRequired"),
);
return;
}
@@ -42,7 +42,7 @@ export class HintComponent implements OnInit {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("invalidEmail")
this.i18nService.t("invalidEmail"),
);
return;
}

View File

@@ -72,7 +72,7 @@ export class LockComponent implements OnInit, OnDestroy {
protected passwordStrengthService: PasswordStrengthServiceAbstraction,
protected dialogService: DialogService,
protected deviceTrustCryptoService: DeviceTrustCryptoServiceAbstraction,
protected userVerificationService: UserVerificationService
protected userVerificationService: UserVerificationService,
) {}
async ngOnInit() {
@@ -81,7 +81,7 @@ export class LockComponent implements OnInit, OnDestroy {
concatMap(async () => {
await this.load();
}),
takeUntil(this.destroy$)
takeUntil(this.destroy$),
)
.subscribe();
}
@@ -141,7 +141,7 @@ export class LockComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("pinRequired")
this.i18nService.t("pinRequired"),
);
return;
}
@@ -185,7 +185,7 @@ export class LockComponent implements OnInit, OnDestroy {
this.email,
kdf,
kdfConfig,
oldPinKey
oldPinKey,
);
} else {
userKey = await this.cryptoService.decryptUserKeyWithPin(
@@ -193,14 +193,14 @@ export class LockComponent implements OnInit, OnDestroy {
this.email,
kdf,
kdfConfig,
userKeyPin
userKeyPin,
);
}
const protectedPin = await this.stateService.getProtectedPin();
const decryptedPin = await this.cryptoService.decryptToUtf8(
new EncString(protectedPin),
userKey
userKey,
);
failed = decryptedPin !== this.pin;
@@ -220,7 +220,7 @@ export class LockComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("invalidPin")
this.i18nService.t("invalidPin"),
);
}
}
@@ -230,7 +230,7 @@ export class LockComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("masterPasswordRequired")
this.i18nService.t("masterPasswordRequired"),
);
return;
}
@@ -245,7 +245,7 @@ export class LockComponent implements OnInit, OnDestroy {
this.masterPassword,
this.email,
kdf,
kdfConfig
kdfConfig,
);
const storedPasswordHash = await this.cryptoService.getMasterKeyHash();
@@ -255,7 +255,7 @@ export class LockComponent implements OnInit, OnDestroy {
// Offline unlock possible
passwordValid = await this.cryptoService.compareAndUpdateKeyHash(
this.masterPassword,
masterKey
masterKey,
);
} else {
// Online only
@@ -263,7 +263,7 @@ export class LockComponent implements OnInit, OnDestroy {
const serverKeyHash = await this.cryptoService.hashMasterKey(
this.masterPassword,
masterKey,
HashPurpose.ServerAuthorization
HashPurpose.ServerAuthorization,
);
request.masterPasswordHash = serverKeyHash;
try {
@@ -274,7 +274,7 @@ export class LockComponent implements OnInit, OnDestroy {
const localKeyHash = await this.cryptoService.hashMasterKey(
this.masterPassword,
masterKey,
HashPurpose.LocalAuthorization
HashPurpose.LocalAuthorization,
);
await this.cryptoService.setMasterKeyHash(localKeyHash);
} catch (e) {
@@ -288,7 +288,7 @@ export class LockComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("invalidMasterPassword")
this.i18nService.t("invalidMasterPassword"),
);
return;
}
@@ -317,13 +317,13 @@ export class LockComponent implements OnInit, OnDestroy {
// If we do not have any saved policies, attempt to load them from the service
if (this.enforcedMasterPasswordOptions == undefined) {
this.enforcedMasterPasswordOptions = await firstValueFrom(
this.policyService.masterPasswordPolicyOptions$()
this.policyService.masterPasswordPolicyOptions$(),
);
}
if (this.requirePasswordChange()) {
await this.stateService.setForceSetPasswordReason(
ForceSetPasswordReason.WeakMasterPassword
ForceSetPasswordReason.WeakMasterPassword,
);
this.router.navigate([this.forcePasswordResetRoute]);
return;
@@ -353,7 +353,7 @@ export class LockComponent implements OnInit, OnDestroy {
// - If they have biometrics enabled, they will be presented with the biometric prompt
const availableVaultTimeoutActions = await firstValueFrom(
this.vaultTimeoutSettingsService.availableVaultTimeoutActions$()
this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(),
);
const supportsLock = availableVaultTimeoutActions.includes(VaultTimeoutAction.Lock);
if (!supportsLock) {
@@ -393,13 +393,13 @@ export class LockComponent implements OnInit, OnDestroy {
const passwordStrength = this.passwordStrengthService.getPasswordStrength(
this.masterPassword,
this.email
this.email,
)?.score;
return !this.policyService.evaluateMasterPassword(
passwordStrength,
this.masterPassword,
this.enforcedMasterPasswordOptions
this.enforcedMasterPasswordOptions,
);
}
}

View File

@@ -83,7 +83,7 @@ export class LoginViaAuthRequestComponent
private stateService: StateService,
private loginService: LoginService,
private deviceTrustCryptoService: DeviceTrustCryptoServiceAbstraction,
private authReqCryptoService: AuthRequestCryptoServiceAbstraction
private authReqCryptoService: AuthRequestCryptoServiceAbstraction,
) {
super(environmentService, i18nService, platformUtilsService);
@@ -183,7 +183,7 @@ export class LoginViaAuthRequestComponent
// Re-derive the user's fingerprint phrase
// It is important to not use the server's public key here as it could have been compromised via MITM
const derivedPublicKeyArrayBuffer = await this.cryptoFunctionService.rsaExtractPublicKey(
adminAuthReqStorable.privateKey
adminAuthReqStorable.privateKey,
);
this.fingerprintPhrase = (
await this.cryptoService.getFingerprint(this.email, derivedPublicKeyArrayBuffer)
@@ -198,7 +198,7 @@ export class LoginViaAuthRequestComponent
if (adminAuthReqResponse.requestApproved) {
return await this.handleApprovedAdminAuthRequest(
adminAuthReqResponse,
adminAuthReqStorable.privateKey
adminAuthReqStorable.privateKey,
);
}
@@ -236,7 +236,7 @@ export class LoginViaAuthRequestComponent
deviceIdentifier,
publicKey,
authRequestType,
accessCode
accessCode,
);
}
@@ -283,7 +283,7 @@ export class LoginViaAuthRequestComponent
// Unauthed - access code required for user verification
authReqResponse = await this.apiService.getAuthResponse(
requestId,
this.authRequest.accessCode
this.authRequest.accessCode,
);
break;
@@ -321,7 +321,7 @@ export class LoginViaAuthRequestComponent
if (this.userAuthNStatus === AuthenticationStatus.Locked) {
return await this.handleApprovedAdminAuthRequest(
authReqResponse,
this.authRequestKeyPair.privateKey
this.authRequestKeyPair.privateKey,
);
}
@@ -346,7 +346,7 @@ export class LoginViaAuthRequestComponent
async handleApprovedAdminAuthRequest(
adminAuthReqResponse: AuthRequestResponse,
privateKey: ArrayBuffer
privateKey: ArrayBuffer,
) {
// See verifyAndHandleApprovedAuthReq(...) for flow details
// it's flow 2 or 3 based on presence of masterPasswordHash
@@ -355,14 +355,14 @@ export class LoginViaAuthRequestComponent
// key is authRequestPublicKey(masterKey) + we have authRequestPublicKey(masterPasswordHash)
await this.authReqCryptoService.setKeysAfterDecryptingSharedMasterKeyAndHash(
adminAuthReqResponse,
privateKey
privateKey,
);
} else {
// Flow 3: masterPasswordHash is null
// we can assume key is authRequestPublicKey(userKey) and we can just decrypt with userKey and proceed to vault
await this.authReqCryptoService.setUserKeyAfterDecryptingSharedUserKey(
adminAuthReqResponse,
privateKey
privateKey,
);
}
@@ -384,7 +384,7 @@ export class LoginViaAuthRequestComponent
// Authentication helper
private async buildAuthRequestLoginCredentials(
requestId: string,
response: AuthRequestResponse
response: AuthRequestResponse,
): Promise<AuthRequestLoginCredentials> {
// if masterPasswordHash has a value, we will always receive key as authRequestPublicKey(masterKey) + authRequestPublicKey(masterPasswordHash)
// if masterPasswordHash is null, we will always receive key as authRequestPublicKey(userKey)
@@ -393,7 +393,7 @@ export class LoginViaAuthRequestComponent
await this.authReqCryptoService.decryptPubKeyEncryptedMasterKeyAndHash(
response.key,
response.masterPasswordHash,
this.authRequestKeyPair.privateKey
this.authRequestKeyPair.privateKey,
);
return new AuthRequestLoginCredentials(
@@ -402,12 +402,12 @@ export class LoginViaAuthRequestComponent
requestId,
null, // no userKey
masterKey,
masterKeyHash
masterKeyHash,
);
} else {
const userKey = await this.authReqCryptoService.decryptPubKeyEncryptedUserKey(
response.key,
this.authRequestKeyPair.privateKey
this.authRequestKeyPair.privateKey,
);
return new AuthRequestLoginCredentials(
this.email,
@@ -415,14 +415,14 @@ export class LoginViaAuthRequestComponent
requestId,
userKey,
null, // no masterKey
null // no masterKeyHash
null, // no masterKeyHash
);
}
}
private async loginViaAuthRequestStrategy(
requestId: string,
authReqResponse: AuthRequestResponse
authReqResponse: AuthRequestResponse,
): Promise<AuthResult> {
// Note: credentials change based on if the authReqResponse.key is a encryptedMasterKey or UserKey
const credentials = await this.buildAuthRequestLoginCredentials(requestId, authReqResponse);

View File

@@ -79,7 +79,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit,
protected formValidationErrorService: FormValidationErrorsService,
protected route: ActivatedRoute,
protected loginService: LoginService,
protected webAuthnLoginService: WebAuthnLoginServiceAbstraction
protected webAuthnLoginService: WebAuthnLoginServiceAbstraction,
) {
super(environmentService, i18nService, platformUtilsService);
}
@@ -149,7 +149,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit,
data.email,
data.masterPassword,
this.captchaToken,
null
null,
);
this.formPromise = this.authService.logIn(credentials);
const response = await this.formPromise;
@@ -244,7 +244,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit,
"&codeChallenge=" +
codeChallenge +
"&email=" +
encodeURIComponent(this.formGroup.controls.email.value)
encodeURIComponent(this.formGroup.controls.email.value),
);
}
@@ -300,7 +300,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit,
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccured"),
this.i18nService.t("encryptionKeyMigrationRequired")
this.i18nService.t("encryptionKeyMigrationRequired"),
);
return true;
}
@@ -334,7 +334,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit,
const deviceIdentifier = await this.appIdService.getAppId();
this.showLoginWithDevice = await this.devicesApiService.getKnownDevice(
email,
deviceIdentifier
deviceIdentifier,
);
} catch (e) {
this.showLoginWithDevice = false;

View File

@@ -57,7 +57,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
[
InputsFieldMatch.validateInputsDoesntMatch(
"masterPassword",
this.i18nService.t("hintEqualsPassword")
this.i18nService.t("hintEqualsPassword"),
),
],
],
@@ -68,9 +68,9 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
validator: InputsFieldMatch.validateFormInputsMatch(
"masterPassword",
"confirmMasterPassword",
this.i18nService.t("masterPassDoesntMatch")
this.i18nService.t("masterPassDoesntMatch"),
),
}
},
);
protected successRoute = "login";
@@ -93,7 +93,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
environmentService: EnvironmentService,
protected logService: LogService,
protected auditService: AuditService,
protected dialogService: DialogService
protected dialogService: DialogService,
) {
super(environmentService, i18nService, platformUtilsService);
this.showTerms = !platformUtilsService.isSelfHost();
@@ -114,7 +114,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
if (!this.accountCreated) {
const registerResponse = await this.registerAccount(
await this.buildRegisterRequest(email, masterPassword, name),
showToast
showToast,
);
if (!registerResponse.successful) {
return;
@@ -127,7 +127,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("trialAccountCreated")
this.i18nService.t("trialAccountCreated"),
);
}
const loginResponse = await this.logIn(email, masterPassword, this.captchaBypassToken);
@@ -139,7 +139,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("newAccountCreated")
this.i18nService.t("newAccountCreated"),
);
this.router.navigate([this.successRoute], { queryParams: { email: email } });
}
@@ -206,7 +206,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("acceptPoliciesRequired")
this.i18nService.t("acceptPoliciesRequired"),
);
return { isValid: false };
}
@@ -267,7 +267,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
private async buildRegisterRequest(
email: string,
masterPassword: string,
name: string
name: string,
): Promise<RegisterRequest> {
const hint = this.formGroup.value.hint;
const kdf = DEFAULT_KDF_TYPE;
@@ -287,7 +287,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
kdf,
kdfConfig.iterations,
kdfConfig.memory,
kdfConfig.parallelism
kdfConfig.parallelism,
);
request.keys = new KeysRequest(keys[0], keys[1].encryptedString);
const orgInvite = await this.stateService.getOrganizationInvitation();
@@ -300,7 +300,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
private async registerAccount(
request: RegisterRequest,
showToast: boolean
showToast: boolean,
): Promise<{ successful: boolean; captchaBypassToken?: string }> {
if (!(await this.validateRegistration(showToast)).isValid) {
return { successful: false };
@@ -321,13 +321,13 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
private async logIn(
email: string,
masterPassword: string,
captchaBypassToken: string
captchaBypassToken: string,
): Promise<{ captchaRequired: boolean }> {
const credentials = new PasswordLoginCredentials(
email,
masterPassword,
captchaBypassToken,
null
null,
);
const loginResponse = await this.authService.logIn(credentials);
if (this.handleCaptchaRequired(loginResponse)) {

View File

@@ -28,7 +28,7 @@ export class RemovePasswordComponent implements OnInit {
private i18nService: I18nService,
private keyConnectorService: KeyConnectorService,
private organizationApiService: OrganizationApiServiceAbstraction,
private dialogService: DialogService
private dialogService: DialogService,
) {}
async ngOnInit() {
@@ -47,7 +47,7 @@ export class RemovePasswordComponent implements OnInit {
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("removedMasterPassword")
this.i18nService.t("removedMasterPassword"),
);
await this.keyConnectorService.removeConvertAccountRequired();
this.router.navigate([""]);

View File

@@ -63,7 +63,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
stateService: StateService,
private organizationApiService: OrganizationApiServiceAbstraction,
private organizationUserService: OrganizationUserService,
dialogService: DialogService
dialogService: DialogService,
) {
super(
i18nService,
@@ -73,7 +73,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
platformUtilsService,
policyService,
stateService,
dialogService
dialogService,
);
}
@@ -109,12 +109,12 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
switchMap((orgAutoEnrollStatusResponse: OrganizationAutoEnrollStatusResponse) =>
// Must get org id from response to get master password policy options
this.policyApiService.getMasterPasswordPolicyOptsForOrgUser(
orgAutoEnrollStatusResponse.id
)
orgAutoEnrollStatusResponse.id,
),
),
tap((masterPasswordPolicyOptions: MasterPasswordPolicyOptions) => {
this.enforcedPolicyOptions = masterPasswordPolicyOptions;
})
}),
)
.subscribe({
error: () => {
@@ -132,7 +132,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
async performSubmitActions(
masterPasswordHash: string,
masterKey: MasterKey,
userKey: [UserKey, EncString]
userKey: [UserKey, EncString],
) {
let keysRequest: KeysRequest | null = null;
let newKeyPair: [string, EncString] | null = null;
@@ -157,7 +157,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
this.kdf,
this.kdfConfig.iterations,
this.kdfConfig.memory,
this.kdfConfig.parallelism
this.kdfConfig.parallelism,
);
try {
if (this.resetPasswordAutoEnroll) {
@@ -185,7 +185,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
return this.organizationUserService.putOrganizationUserResetPasswordEnrollment(
this.orgId,
userId,
resetRequest
resetRequest,
);
});
} else {
@@ -214,7 +214,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
protected async onSetPasswordSuccess(
masterKey: MasterKey,
userKey: [UserKey, EncString],
keyPair: [string, EncString] | null
keyPair: [string, EncString] | null,
) {
// Clear force set password reason to allow navigation back to vault.
await this.stateService.setForceSetPasswordReason(ForceSetPasswordReason.None);
@@ -244,7 +244,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
const localMasterKeyHash = await this.cryptoService.hashMasterKey(
this.masterPassword,
masterKey,
HashPurpose.LocalAuthorization
HashPurpose.LocalAuthorization,
);
await this.cryptoService.setMasterKeyHash(localMasterKeyHash);
}

View File

@@ -19,7 +19,7 @@ export class SetPinComponent implements OnInit {
private modalRef: ModalRef,
private cryptoService: CryptoService,
private userVerificationService: UserVerificationService,
private stateService: StateService
private stateService: StateService,
) {}
async ngOnInit() {
@@ -41,7 +41,7 @@ export class SetPinComponent implements OnInit {
this.pin,
await this.stateService.getEmail(),
await this.stateService.getKdfType(),
await this.stateService.getKdfConfig()
await this.stateService.getKdfConfig(),
);
const userKey = await this.cryptoService.getUserKey();
const pinProtectedKey = await this.cryptoService.encrypt(userKey.key, pinKey);

View File

@@ -227,7 +227,7 @@ describe("SsoComponent", () => {
// use standard user with MP because this test is not concerned with password reset.
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPassword
mockAcctDecryptionOpts.withMasterPassword,
);
mockAuthService.logIn.mockResolvedValue(authResult);
@@ -338,7 +338,7 @@ describe("SsoComponent", () => {
let authResult;
beforeEach(() => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.noMasterPasswordWithTrustedDeviceWithManageResetPassword
mockAcctDecryptionOpts.noMasterPasswordWithTrustedDeviceWithManageResetPassword,
);
authResult = new AuthResult();
@@ -350,7 +350,7 @@ describe("SsoComponent", () => {
expect(mockAuthService.logIn).toHaveBeenCalledTimes(1);
expect(mockStateService.setForceSetPasswordReason).toHaveBeenCalledWith(
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission,
);
expect(mockOnSuccessfulLoginTdeNavigate).not.toHaveBeenCalled();
@@ -358,7 +358,7 @@ describe("SsoComponent", () => {
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
expect(mockRouter.navigate).toHaveBeenCalledWith(
[_component.trustedDeviceEncRoute],
undefined
undefined,
);
expect(mockLogService.error).not.toHaveBeenCalled();
@@ -374,7 +374,7 @@ describe("SsoComponent", () => {
let authResult;
beforeEach(() => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice,
);
authResult = new AuthResult();
@@ -391,7 +391,7 @@ describe("SsoComponent", () => {
let authResult;
beforeEach(() => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice,
);
authResult = new AuthResult();
@@ -406,7 +406,7 @@ describe("SsoComponent", () => {
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
expect(mockRouter.navigate).toHaveBeenCalledWith(
[_component.trustedDeviceEncRoute],
undefined
undefined,
);
expect(mockLogService.error).not.toHaveBeenCalled();
});
@@ -437,7 +437,7 @@ describe("SsoComponent", () => {
beforeEach(() => {
// Only need to test the case where the user has no master password to test the primary change mp flow here
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.noMasterPassword
mockAcctDecryptionOpts.noMasterPassword,
);
});
@@ -447,7 +447,7 @@ describe("SsoComponent", () => {
it("does not navigate to the change password route when the user has key connector even if user has no master password", async () => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.noMasterPasswordWithKeyConnector
mockAcctDecryptionOpts.noMasterPasswordWithKeyConnector,
);
await _component.logIn(code, codeVerifier, orgIdFromState);
@@ -472,7 +472,7 @@ describe("SsoComponent", () => {
beforeEach(() => {
// use standard user with MP because this test is not concerned with password reset.
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPassword
mockAcctDecryptionOpts.withMasterPassword,
);
const authResult = new AuthResult();
@@ -491,7 +491,7 @@ describe("SsoComponent", () => {
authResult.twoFactorProviders = null;
// use standard user with MP because this test is not concerned with password reset.
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPassword
mockAcctDecryptionOpts.withMasterPassword,
);
authResult.forcePasswordReset = ForceSetPasswordReason.None;
mockAuthService.logIn.mockResolvedValue(authResult);
@@ -574,7 +574,7 @@ describe("SsoComponent", () => {
expect(mockPlatformUtilsService.showToast).toHaveBeenCalledWith(
"error",
null,
"ssoKeyConnectorError"
"ssoKeyConnectorError",
);
expect(mockRouter.navigate).not.toHaveBeenCalled();

View File

@@ -59,7 +59,7 @@ export class SsoComponent {
protected environmentService: EnvironmentService,
protected passwordGenerationService: PasswordGenerationServiceAbstraction,
protected logService: LogService,
protected configService: ConfigServiceAbstraction
protected configService: ConfigServiceAbstraction,
) {}
async ngOnInit() {
@@ -98,7 +98,7 @@ export class SsoComponent {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("ssoValidationFailed"),
this.i18nService.t("ssoIdentifierRequired")
this.i18nService.t("ssoIdentifierRequired"),
);
return;
}
@@ -109,7 +109,7 @@ export class SsoComponent {
const authorizeUrl = await this.buildAuthorizeUrl(
returnUri,
includeUserIdentifier,
response.token
response.token,
);
this.platformUtilsService.launchUri(authorizeUrl, { sameWindow: true });
}
@@ -117,7 +117,7 @@ export class SsoComponent {
protected async buildAuthorizeUrl(
returnUri?: string,
includeUserIdentifier?: boolean,
token?: string
token?: string,
): Promise<string> {
let codeChallenge = this.codeChallenge;
let state = this.state;
@@ -186,7 +186,7 @@ export class SsoComponent {
code,
codeVerifier,
this.redirectUri,
orgSsoIdentifier
orgSsoIdentifier,
);
this.formPromise = this.authService.logIn(credentials);
const authResult = await this.formPromise;
@@ -215,14 +215,14 @@ export class SsoComponent {
}
const tdeEnabled = await this.isTrustedDeviceEncEnabled(
acctDecryptionOpts.trustedDeviceOption
acctDecryptionOpts.trustedDeviceOption,
);
if (tdeEnabled) {
return await this.handleTrustedDeviceEncryptionEnabled(
authResult,
orgSsoIdentifier,
acctDecryptionOpts
acctDecryptionOpts,
);
}
@@ -246,10 +246,10 @@ export class SsoComponent {
}
private async isTrustedDeviceEncEnabled(
trustedDeviceOption: TrustedDeviceUserDecryptionOption
trustedDeviceOption: TrustedDeviceUserDecryptionOption,
): Promise<boolean> {
const trustedDeviceEncryptionFeatureActive = await this.configService.getFeatureFlag<boolean>(
FeatureFlag.TrustedDeviceEncryption
FeatureFlag.TrustedDeviceEncryption,
);
return trustedDeviceEncryptionFeatureActive && trustedDeviceOption !== undefined;
@@ -264,14 +264,14 @@ export class SsoComponent {
identifier: orgIdentifier,
sso: "true",
},
}
},
);
}
private async handleTrustedDeviceEncryptionEnabled(
authResult: AuthResult,
orgIdentifier: string,
acctDecryptionOpts: AccountDecryptionOptions
acctDecryptionOpts: AccountDecryptionOptions,
): Promise<void> {
// If user doesn't have a MP, but has reset password permission, they must set a MP
if (
@@ -282,7 +282,7 @@ export class SsoComponent {
// Note: we cannot directly navigate in this scenario as we are in a pre-decryption state, and
// if you try to set a new MP before decrypting, you will invalidate the user's data by making a new user key.
await this.stateService.setForceSetPasswordReason(
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission,
);
}
@@ -295,7 +295,7 @@ export class SsoComponent {
this.onSuccessfulLoginTdeNavigate,
// Navigate to TDE page (if user was on trusted device and TDE has decrypted
// their user key, the login-initiated guard will redirect them to the vault)
[this.trustedDeviceEncRoute]
[this.trustedDeviceEncRoute],
);
}
@@ -307,7 +307,7 @@ export class SsoComponent {
queryParams: {
identifier: orgIdentifier,
},
}
},
);
}
@@ -319,7 +319,7 @@ export class SsoComponent {
queryParams: {
identifier: orgIdentifier,
},
}
},
);
}
@@ -340,7 +340,7 @@ export class SsoComponent {
this.platformUtilsService.showToast(
"error",
null,
this.i18nService.t("ssoKeyConnectorError")
this.i18nService.t("ssoKeyConnectorError"),
);
}
}
@@ -348,7 +348,7 @@ export class SsoComponent {
private async navigateViaCallbackOrRoute(
callback: () => Promise<unknown>,
commands: unknown[],
extras?: NavigationExtras
extras?: NavigationExtras,
): Promise<void> {
if (callback) {
await callback();

View File

@@ -18,7 +18,7 @@ export class TwoFactorOptionsComponent implements OnInit {
protected router: Router,
protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService,
protected win: Window
protected win: Window,
) {}
ngOnInit() {

View File

@@ -210,7 +210,7 @@ describe("TwoFactorComponent", () => {
component.captchaToken = captchaToken;
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPassword
mockAcctDecryptionOpts.withMasterPassword,
);
});
@@ -224,7 +224,7 @@ describe("TwoFactorComponent", () => {
// Assert
expect(mockAuthService.logInTwoFactor).toHaveBeenCalledWith(
new TokenTwoFactorRequest(component.selectedProviderType, token, remember),
captchaToken
captchaToken,
);
});
@@ -286,7 +286,7 @@ describe("TwoFactorComponent", () => {
beforeEach(() => {
// Only need to test the case where the user has no master password to test the primary change mp flow here
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.noMasterPassword
mockAcctDecryptionOpts.noMasterPassword,
);
});
@@ -295,7 +295,7 @@ describe("TwoFactorComponent", () => {
it("does not navigate to the change password route when the user has key connector even if user has no master password", async () => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.noMasterPasswordWithKeyConnector
mockAcctDecryptionOpts.noMasterPasswordWithKeyConnector,
);
await component.doSubmit();
@@ -318,7 +318,7 @@ describe("TwoFactorComponent", () => {
beforeEach(() => {
// use standard user with MP because this test is not concerned with password reset.
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPassword
mockAcctDecryptionOpts.withMasterPassword,
);
const authResult = new AuthResult();
@@ -382,7 +382,7 @@ describe("TwoFactorComponent", () => {
describe("Given Trusted Device Encryption is enabled and user needs to set a master password", () => {
beforeEach(() => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.noMasterPasswordWithTrustedDeviceWithManageResetPassword
mockAcctDecryptionOpts.noMasterPasswordWithTrustedDeviceWithManageResetPassword,
);
const authResult = new AuthResult();
@@ -396,13 +396,13 @@ describe("TwoFactorComponent", () => {
// Assert
expect(mockStateService.setForceSetPasswordReason).toHaveBeenCalledWith(
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission,
);
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
expect(mockRouter.navigate).toHaveBeenCalledWith(
[_component.trustedDeviceEncRoute],
undefined
undefined,
);
});
});
@@ -417,7 +417,7 @@ describe("TwoFactorComponent", () => {
beforeEach(() => {
// use standard user with MP because this test is not concerned with password reset.
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice,
);
const authResult = new AuthResult();
@@ -433,7 +433,7 @@ describe("TwoFactorComponent", () => {
let authResult;
beforeEach(() => {
mockStateService.getAccountDecryptionOptions.mockResolvedValue(
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice
mockAcctDecryptionOpts.withMasterPasswordAndTrustedDevice,
);
authResult = new AuthResult();
@@ -447,7 +447,7 @@ describe("TwoFactorComponent", () => {
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
expect(mockRouter.navigate).toHaveBeenCalledWith(
[_component.trustedDeviceEncRoute],
undefined
undefined,
);
});

View File

@@ -72,7 +72,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
protected twoFactorService: TwoFactorService,
protected appIdService: AppIdService,
protected loginService: LoginService,
protected configService: ConfigServiceAbstraction
protected configService: ConfigServiceAbstraction,
) {
super(environmentService, i18nService, platformUtilsService);
this.webAuthnSupported = this.platformUtilsService.supportsWebAuthn(win);
@@ -113,7 +113,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
if (info === "ready") {
this.webAuthnReady = true;
}
}
},
);
}
@@ -178,7 +178,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("verificationCodeRequired")
this.i18nService.t("verificationCodeRequired"),
);
return;
}
@@ -208,7 +208,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
async doSubmit() {
this.formPromise = this.authService.logInTwoFactor(
new TokenTwoFactorRequest(this.selectedProviderType, this.token, this.remember),
this.captchaToken
this.captchaToken,
);
const authResult: AuthResult = await this.formPromise;
@@ -223,7 +223,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccured"),
this.i18nService.t("encryptionKeyMigrationRequired")
this.i18nService.t("encryptionKeyMigrationRequired"),
);
return true;
}
@@ -255,7 +255,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
return await this.handleTrustedDeviceEncryptionEnabled(
authResult,
this.orgIdentifier,
acctDecryptionOpts
acctDecryptionOpts,
);
}
@@ -272,11 +272,11 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
}
private async isTrustedDeviceEncEnabled(
trustedDeviceOption: TrustedDeviceUserDecryptionOption
trustedDeviceOption: TrustedDeviceUserDecryptionOption,
): Promise<boolean> {
const ssoTo2faFlowActive = this.route.snapshot.queryParamMap.get("sso") === "true";
const trustedDeviceEncryptionFeatureActive = await this.configService.getFeatureFlag<boolean>(
FeatureFlag.TrustedDeviceEncryption
FeatureFlag.TrustedDeviceEncryption,
);
return (
@@ -289,7 +289,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
private async handleTrustedDeviceEncryptionEnabled(
authResult: AuthResult,
orgIdentifier: string,
acctDecryptionOpts: AccountDecryptionOptions
acctDecryptionOpts: AccountDecryptionOptions,
): Promise<void> {
// If user doesn't have a MP, but has reset password permission, they must set a MP
if (
@@ -300,7 +300,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
// Note: we cannot directly navigate to the set password screen in this scenario as we are in a pre-decryption state, and
// if you try to set a new MP before decrypting, you will invalidate the user's data by making a new user key.
await this.stateService.setForceSetPasswordReason(
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission
ForceSetPasswordReason.TdeUserWithoutPasswordHasPasswordResetPermission,
);
}
@@ -314,7 +314,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
this.onSuccessfulLoginTdeNavigate,
// Navigate to TDE page (if user was on trusted device and TDE has decrypted
// their user key, the login-initiated guard will redirect them to the vault)
[this.trustedDeviceEncRoute]
[this.trustedDeviceEncRoute],
);
}
@@ -365,7 +365,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
private async navigateViaCallbackOrRoute(
callback: () => Promise<unknown>,
commands: unknown[],
extras?: NavigationExtras
extras?: NavigationExtras,
): Promise<void> {
if (callback) {
await callback();
@@ -387,7 +387,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("sessionTimeout")
this.i18nService.t("sessionTimeout"),
);
return;
}
@@ -406,7 +406,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("verificationCodeEmailSent", this.twoFactorEmail)
this.i18nService.t("verificationCodeEmailSent", this.twoFactorEmail),
);
}
} catch (e) {

View File

@@ -43,7 +43,7 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent {
stateService: StateService,
private userVerificationService: UserVerificationService,
private logService: LogService,
dialogService: DialogService
dialogService: DialogService,
) {
super(
i18nService,
@@ -53,7 +53,7 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent {
platformUtilsService,
policyService,
stateService,
dialogService
dialogService,
);
}
@@ -72,7 +72,7 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("masterPasswordRequired")
this.i18nService.t("masterPasswordRequired"),
);
return false;
}
@@ -96,14 +96,14 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent {
async performSubmitActions(
newMasterKeyHash: string,
newMasterKey: MasterKey,
newUserKey: [UserKey, EncString]
newUserKey: [UserKey, EncString],
) {
try {
// Create Request
const request = new PasswordRequest();
request.masterPasswordHash = await this.cryptoService.hashMasterKey(
this.currentMasterPassword,
await this.cryptoService.getOrDeriveMasterKey(this.currentMasterPassword)
await this.cryptoService.getOrDeriveMasterKey(this.currentMasterPassword),
);
request.newMasterPasswordHash = newMasterKeyHash;
request.key = newUserKey[1].encryptedString;
@@ -114,7 +114,7 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent {
this.platformUtilsService.showToast(
"success",
this.i18nService.t("masterPasswordChanged"),
this.i18nService.t("logBackIn")
this.i18nService.t("logBackIn"),
);
if (this.onSuccessfulChangePassword != null) {

View File

@@ -55,7 +55,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
private logService: LogService,
private userVerificationService: UserVerificationService,
private router: Router,
dialogService: DialogService
dialogService: DialogService,
) {
super(
i18nService,
@@ -65,7 +65,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
platformUtilsService,
policyService,
stateService,
dialogService
dialogService,
);
}
@@ -117,11 +117,11 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
this.masterPassword,
this.email.trim().toLowerCase(),
this.kdf,
this.kdfConfig
this.kdfConfig,
);
const newPasswordHash = await this.cryptoService.hashMasterKey(
this.masterPassword,
newMasterKey
newMasterKey,
);
// Grab user key
@@ -130,7 +130,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
// Encrypt user key with new master key
const newProtectedUserKey = await this.cryptoService.encryptUserKeyWithMasterKey(
newMasterKey,
userKey
userKey,
);
await this.performSubmitActions(newPasswordHash, newMasterKey, newProtectedUserKey);
@@ -142,7 +142,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
async performSubmitActions(
masterPasswordHash: string,
masterKey: MasterKey,
userKey: [UserKey, EncString]
userKey: [UserKey, EncString],
) {
try {
switch (this.reason) {
@@ -158,7 +158,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("updatedMasterPassword")
this.i18nService.t("updatedMasterPassword"),
);
await this.stateService.setForceSetPasswordReason(ForceSetPasswordReason.None);
@@ -184,7 +184,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
private async updatePassword(newMasterPasswordHash: string, userKey: [UserKey, EncString]) {
const request = await this.userVerificationService.buildRequest(
this.verification,
PasswordRequest
PasswordRequest,
);
request.masterPasswordHint = this.hint;
request.newMasterPasswordHash = newMasterPasswordHash;

View File

@@ -30,7 +30,7 @@ export class UserVerificationPromptComponent {
protected userVerificationService: UserVerificationService,
private formBuilder: FormBuilder,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService
private i18nService: I18nService,
) {}
get secret() {

View File

@@ -65,7 +65,7 @@ export class UserVerificationComponent implements ControlValueAccessor, OnInit,
constructor(
private cryptoService: CryptoService,
private userVerificationService: UserVerificationService,
private i18nService: I18nService
private i18nService: I18nService,
) {}
async ngOnInit() {

View File

@@ -15,7 +15,7 @@ export class AuthGuard implements CanActivate {
private router: Router,
private messagingService: MessagingService,
private keyConnectorService: KeyConnectorService,
private stateService: StateService
private stateService: StateService,
) {}
async canActivate(route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) {

View File

@@ -23,7 +23,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
export function lockGuard(): CanActivateFn {
return async (
activatedRouteSnapshot: ActivatedRouteSnapshot,
routerStateSnapshot: RouterStateSnapshot
routerStateSnapshot: RouterStateSnapshot,
) => {
const authService = inject(AuthService);
const cryptoService = inject(CryptoService);

View File

@@ -7,7 +7,10 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio
@Injectable()
export class UnauthGuard implements CanActivate {
protected homepage = "vault";
constructor(private authService: AuthService, private router: Router) {}
constructor(
private authService: AuthService,
private router: Router,
) {}
async canActivate() {
const authStatus = await this.authService.getAuthStatus();