mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +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:
@@ -27,7 +27,7 @@ export class CollectionsComponent implements OnInit {
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected i18nService: I18nService,
|
||||
protected cipherService: CipherService,
|
||||
private logService: LogService
|
||||
private logService: LogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -38,7 +38,7 @@ export class CollectionsComponent implements OnInit {
|
||||
this.cipherDomain = await this.loadCipher();
|
||||
this.collectionIds = this.loadCipherCollections();
|
||||
this.cipher = await this.cipherDomain.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain),
|
||||
);
|
||||
this.collections = await this.loadCollections();
|
||||
|
||||
@@ -58,7 +58,7 @@ export class CollectionsComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("selectOneCollection")
|
||||
this.i18nService.t("selectOneCollection"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export class CollectionsComponent implements OnInit {
|
||||
protected async loadCollections() {
|
||||
const allCollections = await this.collectionService.getAllDecrypted();
|
||||
return allCollections.filter(
|
||||
(c) => !c.readOnly && c.organizationId === this.cipher.organizationId
|
||||
(c) => !c.readOnly && c.organizationId === this.cipher.organizationId,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { AbstractControl, AsyncValidatorFn, ValidationErrors } from "@angular/fo
|
||||
|
||||
export function notAllowedValueAsync(
|
||||
valueGetter: () => Promise<string>,
|
||||
caseInsensitive = false
|
||||
caseInsensitive = false,
|
||||
): AsyncValidatorFn {
|
||||
return async (control: AbstractControl): Promise<ValidationErrors | null> => {
|
||||
let notAllowedValue = await valueGetter();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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([""]);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,7 +30,7 @@ export class UserVerificationPromptComponent {
|
||||
protected userVerificationService: UserVerificationService,
|
||||
private formBuilder: FormBuilder,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
get secret() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
{{ enforcedPolicyMessage }}
|
||||
<ul>
|
||||
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
|
||||
{{ "policyInEffectMinComplexity" | i18n : getPasswordScoreAlertDisplay() }}
|
||||
{{ "policyInEffectMinComplexity" | i18n: getPasswordScoreAlertDisplay() }}
|
||||
</li>
|
||||
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
|
||||
{{ "policyInEffectMinLength" | i18n : enforcedPolicyOptions?.minLength.toString() }}
|
||||
{{ "policyInEffectMinLength" | i18n: enforcedPolicyOptions?.minLength.toString() }}
|
||||
</li>
|
||||
<li *ngIf="enforcedPolicyOptions?.requireUpper">
|
||||
{{ "policyInEffectUppercase" | i18n }}
|
||||
@@ -27,7 +27,7 @@
|
||||
{{ "policyInEffectNumbers" | i18n }}
|
||||
</li>
|
||||
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
|
||||
{{ "policyInEffectSpecial" | i18n : "!@#$%^&*" }}
|
||||
{{ "policyInEffectSpecial" | i18n: "!@#$%^&*" }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
||||
private cd: ChangeDetectorRef,
|
||||
private el: ElementRef<HTMLElement>,
|
||||
private focusTrapFactory: ConfigurableFocusTrapFactory,
|
||||
public modalRef: ModalRef
|
||||
public modalRef: ModalRef,
|
||||
) {}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -47,7 +47,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
||||
|
||||
this.modalRef.created(this.el.nativeElement);
|
||||
this.focusTrap = this.focusTrapFactory.create(
|
||||
this.el.nativeElement.querySelector(".modal-dialog")
|
||||
this.el.nativeElement.querySelector(".modal-dialog"),
|
||||
);
|
||||
if (this.el.nativeElement.querySelector("[appAutoFocus]") == null) {
|
||||
this.focusTrap.focusFirstTabbableElementWhenReady();
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { InjectFlags, InjectOptions, Injector, ProviderToken } from "@angular/core";
|
||||
|
||||
export class ModalInjector implements Injector {
|
||||
constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap<any, any>) {}
|
||||
constructor(
|
||||
private _parentInjector: Injector,
|
||||
private _additionalTokens: WeakMap<any, any>,
|
||||
) {}
|
||||
|
||||
get<T>(
|
||||
token: ProviderToken<T>,
|
||||
notFoundValue: undefined,
|
||||
options: InjectOptions & { optional?: false }
|
||||
options: InjectOptions & { optional?: false },
|
||||
): T;
|
||||
get<T>(token: ProviderToken<T>, notFoundValue: null, options: InjectOptions): T;
|
||||
get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
|
||||
|
||||
@@ -63,7 +63,7 @@ export class VaultTimeoutInputComponent
|
||||
private formBuilder: FormBuilder,
|
||||
private policyService: PolicyService,
|
||||
private vaultTimeoutSettingsService: VaultTimeoutSettingsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -71,7 +71,7 @@ export class VaultTimeoutInputComponent
|
||||
.get$(PolicyType.MaximumVaultTimeout)
|
||||
.pipe(
|
||||
filter((policy) => policy != null),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((policy) => {
|
||||
this.vaultTimeoutPolicy = policy;
|
||||
@@ -93,7 +93,7 @@ export class VaultTimeoutInputComponent
|
||||
this.form.controls.vaultTimeout.valueChanges
|
||||
.pipe(
|
||||
filter((value) => value !== VaultTimeoutInputComponent.CUSTOM_VALUE),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((value) => {
|
||||
const current = Math.max(value, 0);
|
||||
@@ -108,7 +108,7 @@ export class VaultTimeoutInputComponent
|
||||
minutes: current % 60,
|
||||
},
|
||||
},
|
||||
{ emitEvent: false }
|
||||
{ emitEvent: false },
|
||||
);
|
||||
});
|
||||
|
||||
@@ -202,7 +202,7 @@ export class VaultTimeoutInputComponent
|
||||
(t) =>
|
||||
t.value <= this.vaultTimeoutPolicy.data.minutes &&
|
||||
(t.value > 0 || t.value === VaultTimeoutInputComponent.CUSTOM_VALUE) &&
|
||||
t.value != null
|
||||
t.value != null,
|
||||
);
|
||||
this.validatorChange();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ShareComponent implements OnInit, OnDestroy {
|
||||
protected i18nService: I18nService,
|
||||
protected cipherService: CipherService,
|
||||
private logService: LogService,
|
||||
protected organizationService: OrganizationService
|
||||
protected organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -56,7 +56,7 @@ export class ShareComponent implements OnInit, OnDestroy {
|
||||
return orgs
|
||||
.filter((o) => o.enabled && o.status === OrganizationUserStatusType.Confirmed)
|
||||
.sort(Utils.getSortFunction(this.i18nService, "name"));
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
this.organizations$.pipe(takeUntil(this._destroy)).subscribe((orgs) => {
|
||||
@@ -67,7 +67,7 @@ export class ShareComponent implements OnInit, OnDestroy {
|
||||
|
||||
const cipherDomain = await this.cipherService.get(this.cipherId);
|
||||
this.cipher = await cipherDomain.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipherDomain)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipherDomain),
|
||||
);
|
||||
|
||||
this.filterCollections();
|
||||
@@ -79,7 +79,7 @@ export class ShareComponent implements OnInit, OnDestroy {
|
||||
this.collections = [];
|
||||
} else {
|
||||
this.collections = this.writeableCollections.filter(
|
||||
(c) => c.organizationId === this.organizationId
|
||||
(c) => c.organizationId === this.organizationId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -90,14 +90,14 @@ export class ShareComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("selectOneCollection")
|
||||
this.i18nService.t("selectOneCollection"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const cipherDomain = await this.cipherService.get(this.cipherId);
|
||||
const cipherView = await cipherDomain.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipherDomain)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipherDomain),
|
||||
);
|
||||
const orgs = await firstValueFrom(this.organizations$);
|
||||
const orgName =
|
||||
@@ -111,7 +111,7 @@ export class ShareComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("movedItemToOrg", cipherView.name, orgName)
|
||||
this.i18nService.t("movedItemToOrg", cipherView.name, orgName),
|
||||
);
|
||||
});
|
||||
await this.formPromise;
|
||||
|
||||
@@ -62,7 +62,10 @@ import {
|
||||
preserveWhitespaces: false,
|
||||
})
|
||||
export class BitwardenToast extends BaseToast {
|
||||
constructor(protected toastrService: ToastrService, public toastPackage: ToastPackage) {
|
||||
constructor(
|
||||
protected toastrService: ToastrService,
|
||||
public toastPackage: ToastPackage,
|
||||
) {
|
||||
super(toastrService, toastPackage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ import { Subscription } from "rxjs";
|
||||
export class A11yInvalidDirective implements OnDestroy, OnInit {
|
||||
private sub: Subscription;
|
||||
|
||||
constructor(private el: ElementRef<HTMLInputElement>, private formControlDirective: NgControl) {}
|
||||
constructor(
|
||||
private el: ElementRef<HTMLInputElement>,
|
||||
private formControlDirective: NgControl,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.formControlDirective.control.statusChanges.subscribe((status) => {
|
||||
|
||||
@@ -10,7 +10,10 @@ export class A11yTitleDirective {
|
||||
|
||||
private title: string;
|
||||
|
||||
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private renderer: Renderer2,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (!this.el.nativeElement.hasAttribute("title")) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ApiActionDirective implements OnChanges {
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private validationService: ValidationService,
|
||||
private logService: LogService
|
||||
private logService: LogService,
|
||||
) {}
|
||||
|
||||
ngOnChanges(changes: any) {
|
||||
@@ -42,7 +42,7 @@ export class ApiActionDirective implements OnChanges {
|
||||
}
|
||||
this.logService?.error(`Received API exception: ${e}`);
|
||||
this.validationService.showError(e);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ export class AutofocusDirective {
|
||||
|
||||
private autofocus: boolean;
|
||||
|
||||
constructor(private el: ElementRef, private ngZone: NgZone) {}
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private ngZone: NgZone,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (!Utils.isMobileBrowser && this.autofocus) {
|
||||
|
||||
@@ -13,7 +13,7 @@ export class BoxRowDirective implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.formEls = Array.from(
|
||||
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea')
|
||||
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea'),
|
||||
);
|
||||
this.formEls.forEach((formEl) => {
|
||||
formEl.addEventListener(
|
||||
@@ -21,7 +21,7 @@ export class BoxRowDirective implements OnInit {
|
||||
() => {
|
||||
this.el.classList.add("active");
|
||||
},
|
||||
false
|
||||
false,
|
||||
);
|
||||
|
||||
formEl.addEventListener(
|
||||
@@ -29,7 +29,7 @@ export class BoxRowDirective implements OnInit {
|
||||
() => {
|
||||
this.el.classList.remove("active");
|
||||
},
|
||||
false
|
||||
false,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export class CipherListVirtualScrollStrategy extends FixedSizeVirtualScrollStrat
|
||||
itemSize: number,
|
||||
minBufferPx: number,
|
||||
maxBufferPx: number,
|
||||
checkItemSizeCallback: any
|
||||
checkItemSizeCallback: any,
|
||||
) {
|
||||
super(itemSize, minBufferPx, maxBufferPx);
|
||||
this.checkItemSizeCallback = checkItemSizeCallback;
|
||||
@@ -54,13 +54,13 @@ export class CipherListVirtualScroll extends CdkFixedSizeVirtualScroll {
|
||||
this.itemSize,
|
||||
this.minBufferPx,
|
||||
this.maxBufferPx,
|
||||
this.checkAndUpdateItemSize
|
||||
this.checkAndUpdateItemSize,
|
||||
);
|
||||
}
|
||||
|
||||
checkAndUpdateItemSize = () => {
|
||||
const sampleItem = document.querySelector(
|
||||
"cdk-virtual-scroll-viewport .virtual-scroll-item"
|
||||
"cdk-virtual-scroll-viewport .virtual-scroll-item",
|
||||
) as HTMLElement;
|
||||
const newItemSize = sampleItem?.offsetHeight;
|
||||
|
||||
@@ -69,7 +69,7 @@ export class CipherListVirtualScroll extends CdkFixedSizeVirtualScroll {
|
||||
this._scrollStrategy.updateItemAndBufferSize(
|
||||
this.itemSize,
|
||||
this.minBufferPx,
|
||||
this.maxBufferPx
|
||||
this.maxBufferPx,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,10 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
||||
selector: "[appCopyText]",
|
||||
})
|
||||
export class CopyTextDirective {
|
||||
constructor(private el: ElementRef, private platformUtilsService: PlatformUtilsService) {}
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {}
|
||||
|
||||
@Input("appCopyText") copyText: string;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("IfFeatureDirective", () => {
|
||||
|
||||
const mockConfigFlagValue = (flag: FeatureFlag, flagValue: FeatureFlagValue) => {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((f, defaultValue) =>
|
||||
flag == f ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == f ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export class IfFeatureDirective implements OnInit {
|
||||
private templateRef: TemplateRef<any>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private configService: ConfigServiceAbstraction,
|
||||
private logService: LogService
|
||||
private logService: LogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
|
||||
@@ -10,7 +10,10 @@ export class InputVerbatimDirective {
|
||||
|
||||
private disableComplete: boolean;
|
||||
|
||||
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private renderer: Renderer2,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.disableComplete && !this.el.nativeElement.hasAttribute("autocomplete")) {
|
||||
|
||||
@@ -12,7 +12,7 @@ export class NotPremiumDirective implements OnInit {
|
||||
constructor(
|
||||
private templateRef: TemplateRef<any>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
|
||||
@@ -12,7 +12,7 @@ export class PremiumDirective implements OnInit {
|
||||
constructor(
|
||||
private templateRef: TemplateRef<any>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
|
||||
@@ -16,7 +16,10 @@ export class TrueFalseValueDirective implements ControlValueAccessor {
|
||||
@Input() trueValue: boolean | string = true;
|
||||
@Input() falseValue: boolean | string = false;
|
||||
|
||||
constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
|
||||
constructor(
|
||||
private elementRef: ElementRef,
|
||||
private renderer: Renderer2,
|
||||
) {}
|
||||
|
||||
@HostListener("change", ["$event"])
|
||||
onHostChange(ev: any) {
|
||||
|
||||
@@ -17,7 +17,7 @@ export class ColorPasswordPipe implements PipeTransform {
|
||||
|
||||
protected generateTemplate(
|
||||
password: string,
|
||||
templateGenerator: (character: string, type: string, index?: number) => string
|
||||
templateGenerator: (character: string, type: string, index?: number) => string,
|
||||
) {
|
||||
// Convert to an array to handle cases that stings have special characters, ie: emoji.
|
||||
const passwordArray = Array.from(password);
|
||||
|
||||
@@ -11,21 +11,21 @@ export class SearchPipe implements PipeTransform {
|
||||
searchText: string,
|
||||
prop1?: keyof T,
|
||||
prop2?: keyof T,
|
||||
prop3?: keyof T
|
||||
prop3?: keyof T,
|
||||
): T[];
|
||||
transform<T>(
|
||||
items: T[],
|
||||
searchText: string,
|
||||
prop1?: PropertyValueFunction<T>,
|
||||
prop2?: PropertyValueFunction<T>,
|
||||
prop3?: PropertyValueFunction<T>
|
||||
prop3?: PropertyValueFunction<T>,
|
||||
): T[];
|
||||
transform<T>(
|
||||
items: T[],
|
||||
searchText: string,
|
||||
prop1?: keyof T | PropertyValueFunction<T>,
|
||||
prop2?: keyof T | PropertyValueFunction<T>,
|
||||
prop3?: keyof T | PropertyValueFunction<T>
|
||||
prop3?: keyof T | PropertyValueFunction<T>,
|
||||
): T[] {
|
||||
if (items == null || items.length === 0) {
|
||||
return [];
|
||||
|
||||
@@ -31,15 +31,15 @@ describe("canAccessFeature", () => {
|
||||
// Mock the correct getter based on the type of flagValue; also mock default values if one is not provided
|
||||
if (typeof flagValue === "boolean") {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((flag, defaultValue = false) =>
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
} else if (typeof flagValue === "string") {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((flag, defaultValue = "") =>
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
} else if (typeof flagValue === "number") {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((flag, defaultValue = 0) =>
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ describe("canAccessFeature", () => {
|
||||
expect(mockPlatformUtilsService.showToast).toHaveBeenCalledWith(
|
||||
"error",
|
||||
null,
|
||||
"Access Denied!"
|
||||
"Access Denied!",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type FlagValue = boolean | number | string;
|
||||
export const canAccessFeature = (
|
||||
featureFlag: FeatureFlag,
|
||||
requiredFlagValue: FlagValue = true,
|
||||
redirectUrlOnDisabled?: string
|
||||
redirectUrlOnDisabled?: string,
|
||||
): CanActivateFn => {
|
||||
return async () => {
|
||||
const configService = inject(ConfigServiceAbstraction);
|
||||
|
||||
@@ -7,7 +7,10 @@ export class ThemeBuilder implements Theme {
|
||||
return this.configuredTheme != ThemeType.System ? this.configuredTheme : this.systemTheme;
|
||||
}
|
||||
|
||||
constructor(readonly configuredTheme: ThemeType, readonly systemTheme: ThemeType) {}
|
||||
constructor(
|
||||
readonly configuredTheme: ThemeType,
|
||||
readonly systemTheme: ThemeType,
|
||||
) {}
|
||||
|
||||
updateSystemTheme(systemTheme: ThemeType): ThemeBuilder {
|
||||
return new ThemeBuilder(this.configuredTheme, systemTheme);
|
||||
|
||||
@@ -19,14 +19,14 @@ export class ThemingService implements AbstractThemingService {
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
@Inject(WINDOW) private window: Window,
|
||||
@Inject(DOCUMENT) private document: Document
|
||||
@Inject(DOCUMENT) private document: Document,
|
||||
) {
|
||||
this.monitorThemeChanges();
|
||||
}
|
||||
|
||||
async monitorThemeChanges(): Promise<void> {
|
||||
this._theme.next(
|
||||
new ThemeBuilder(await this.stateService.getTheme(), await this.getSystemTheme())
|
||||
new ThemeBuilder(await this.stateService.getTheme(), await this.getSystemTheme()),
|
||||
);
|
||||
this.monitorConfiguredThemeChanges();
|
||||
this.monitorSystemThemeChanges();
|
||||
@@ -47,7 +47,7 @@ export class ThemingService implements AbstractThemingService {
|
||||
"theme_" + ThemeType.Light,
|
||||
"theme_" + ThemeType.Dark,
|
||||
"theme_" + ThemeType.Nord,
|
||||
"theme_" + ThemeType.SolarizedDark
|
||||
"theme_" + ThemeType.SolarizedDark,
|
||||
);
|
||||
this.document.documentElement.classList.add("theme_" + theme.effectiveTheme);
|
||||
});
|
||||
@@ -64,7 +64,7 @@ export class ThemingService implements AbstractThemingService {
|
||||
protected monitorSystemThemeChanges(): void {
|
||||
fromEvent<MediaQueryListEvent>(
|
||||
window.matchMedia("(prefers-color-scheme: dark)"),
|
||||
"change"
|
||||
"change",
|
||||
).subscribe((event) => {
|
||||
this.updateSystemTheme(event.matches ? ThemeType.Dark : ThemeType.Light);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,8 @@ $icomoon-font-path: "~@bitwarden/angular/src/scss/bwicons/fonts/" !default;
|
||||
// New font sheet? Update the font-face information below
|
||||
@font-face {
|
||||
font-family: "#{$icomoon-font-family}";
|
||||
src: url($icomoon-font-path + "bwi-font.svg") format("svg"),
|
||||
src:
|
||||
url($icomoon-font-path + "bwi-font.svg") format("svg"),
|
||||
url($icomoon-font-path + "bwi-font.ttf") format("truetype"),
|
||||
url($icomoon-font-path + "bwi-font.woff") format("woff"),
|
||||
url($icomoon-font-path + "bwi-font.woff2") format("woff2");
|
||||
|
||||
@@ -22,7 +22,7 @@ export const LOGOUT_CALLBACK = new InjectionToken<
|
||||
(expired: boolean, userId?: string) => Promise<void>
|
||||
>("LOGOUT_CALLBACK");
|
||||
export const LOCKED_CALLBACK = new InjectionToken<(userId?: string) => Promise<void>>(
|
||||
"LOCKED_CALLBACK"
|
||||
"LOCKED_CALLBACK",
|
||||
);
|
||||
export const LOCALES_DIRECTORY = new InjectionToken<string>("LOCALES_DIRECTORY");
|
||||
export const SYSTEM_LANGUAGE = new InjectionToken<string>("SYSTEM_LANGUAGE");
|
||||
|
||||
@@ -291,7 +291,7 @@ import { ModalService } from "./modal.service";
|
||||
stateService: StateServiceAbstraction,
|
||||
encryptService: EncryptService,
|
||||
fileUploadService: CipherFileUploadServiceAbstraction,
|
||||
configService: ConfigServiceAbstraction
|
||||
configService: ConfigServiceAbstraction,
|
||||
) =>
|
||||
new CipherService(
|
||||
cryptoService,
|
||||
@@ -302,7 +302,7 @@ import { ModalService } from "./modal.service";
|
||||
stateService,
|
||||
encryptService,
|
||||
fileUploadService,
|
||||
configService
|
||||
configService,
|
||||
),
|
||||
deps: [
|
||||
CryptoServiceAbstraction,
|
||||
@@ -792,7 +792,7 @@ export class JslibServicesModule {}
|
||||
function encryptServiceFactory(
|
||||
cryptoFunctionservice: CryptoFunctionServiceAbstraction,
|
||||
logService: LogService,
|
||||
logMacFailures: boolean
|
||||
logMacFailures: boolean,
|
||||
): EncryptService {
|
||||
return flagEnabled("multithreadDecryption")
|
||||
? new MultithreadEncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures)
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ModalService {
|
||||
constructor(
|
||||
private componentFactoryResolver: ComponentFactoryResolver,
|
||||
private applicationRef: ApplicationRef,
|
||||
private injector: Injector
|
||||
private injector: Injector,
|
||||
) {
|
||||
document.addEventListener("keyup", (event) => {
|
||||
if (event.key === "Escape" && this.modalCount > 0) {
|
||||
@@ -60,7 +60,7 @@ export class ModalService {
|
||||
async openViewRef<T>(
|
||||
componentType: Type<T>,
|
||||
viewContainerRef: ViewContainerRef,
|
||||
setComponentParameters: (component: T) => void = null
|
||||
setComponentParameters: (component: T) => void = null,
|
||||
): Promise<[ModalRef, T]> {
|
||||
const [modalRef, modalComponentRef] = this.openInternal(componentType, null, false);
|
||||
modalComponentRef.instance.setComponentParameters = setComponentParameters;
|
||||
@@ -103,7 +103,7 @@ export class ModalService {
|
||||
protected openInternal(
|
||||
componentType: Type<any>,
|
||||
config?: ModalConfig,
|
||||
attachToDom?: boolean
|
||||
attachToDom?: boolean,
|
||||
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
||||
const [modalRef, componentRef] = this.createModalComponent(config);
|
||||
componentRef.instance.childComponentType = componentType;
|
||||
@@ -154,7 +154,7 @@ export class ModalService {
|
||||
dialogEl.style.zIndex = `${this.modalCount}050`;
|
||||
|
||||
const modals = Array.from(
|
||||
el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]')
|
||||
el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]'),
|
||||
);
|
||||
for (const closeElement of modals) {
|
||||
closeElement.addEventListener("click", () => {
|
||||
@@ -174,7 +174,7 @@ export class ModalService {
|
||||
}
|
||||
|
||||
protected createModalComponent(
|
||||
config: ModalConfig
|
||||
config: ModalConfig,
|
||||
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
||||
const modalRef = new ModalRef();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export class PasswordStrengthComponent implements OnChanges {
|
||||
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private passwordStrengthService: PasswordStrengthServiceAbstraction
|
||||
private passwordStrengthService: PasswordStrengthServiceAbstraction,
|
||||
) {}
|
||||
|
||||
ngOnChanges(): void {
|
||||
@@ -99,7 +99,7 @@ export class PasswordStrengthComponent implements OnChanges {
|
||||
const strengthResult = this.passwordStrengthService.getPasswordStrength(
|
||||
masterPassword,
|
||||
this.email,
|
||||
this.name?.trim().toLowerCase().split(" ")
|
||||
this.name?.trim().toLowerCase().split(" "),
|
||||
);
|
||||
this.passwordStrengthResult.emit(strengthResult);
|
||||
this.masterPasswordScore = strengthResult == null ? null : strengthResult.score;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ng-container *ngIf="show">
|
||||
<app-callout type="info" title="{{ scopeConfig.title | i18n }}">
|
||||
{{ scopeConfig.description | i18n : scopeConfig.scopeIdentifier }}
|
||||
{{ scopeConfig.description | i18n: scopeConfig.scopeIdentifier }}
|
||||
</app-callout>
|
||||
</ng-container>
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ExportScopeCalloutComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
protected organizationService: OrganizationService,
|
||||
protected stateService: StateService
|
||||
protected stateService: StateService,
|
||||
) {}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
|
||||
@@ -59,7 +59,7 @@ export class ExportComponent implements OnInit, OnDestroy {
|
||||
private userVerificationService: UserVerificationService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
protected fileDownloadService: FileDownloadService,
|
||||
protected dialogService: DialogService
|
||||
protected dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -75,7 +75,7 @@ export class ExportComponent implements OnInit, OnDestroy {
|
||||
|
||||
merge(
|
||||
this.exportForm.get("format").valueChanges,
|
||||
this.exportForm.get("fileEncryptionType").valueChanges
|
||||
this.exportForm.get("fileEncryptionType").valueChanges,
|
||||
)
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.pipe(startWith(0))
|
||||
@@ -109,7 +109,7 @@ export class ExportComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("personalVaultExportPolicyInEffect")
|
||||
this.i18nService.t("personalVaultExportPolicyInEffect"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export class GeneratorComponent implements OnInit {
|
||||
protected i18nService: I18nService,
|
||||
protected logService: LogService,
|
||||
protected route: ActivatedRoute,
|
||||
private win: Window
|
||||
private win: Window,
|
||||
) {
|
||||
this.typeOptions = [
|
||||
{ name: i18nService.t("password"), value: "password" },
|
||||
@@ -180,7 +180,7 @@ export class GeneratorComponent implements OnInit {
|
||||
async generateUsername() {
|
||||
try {
|
||||
this.usernameGeneratingPromise = this.usernameGenerationService.generateUsername(
|
||||
this.usernameOptions
|
||||
this.usernameOptions,
|
||||
);
|
||||
this.username = await this.usernameGeneratingPromise;
|
||||
if (this.username === "" || this.username === null) {
|
||||
@@ -196,12 +196,12 @@ export class GeneratorComponent implements OnInit {
|
||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||
this.platformUtilsService.copyToClipboard(
|
||||
password ? this.password : this.username,
|
||||
copyOptions
|
||||
copyOptions,
|
||||
);
|
||||
this.platformUtilsService.showToast(
|
||||
"info",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t(password ? "password" : "username"))
|
||||
this.i18nService.t("valueCopied", this.i18nService.t(password ? "password" : "username")),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ export class GeneratorComponent implements OnInit {
|
||||
|
||||
this.passwordGenerationService.normalizeOptions(
|
||||
this.passwordOptions,
|
||||
this.enforcedPasswordPolicyOptions
|
||||
this.enforcedPasswordPolicyOptions,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
|
||||
protected passwordGenerationService: PasswordGenerationServiceAbstraction,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected i18nService: I18nService,
|
||||
private win: Window
|
||||
private win: Window,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -33,7 +33,7 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"info",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("password"))
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("password")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
protected stateService: StateService,
|
||||
protected sendApiService: SendApiService,
|
||||
protected dialogService: DialogService,
|
||||
protected formBuilder: FormBuilder
|
||||
protected formBuilder: FormBuilder,
|
||||
) {
|
||||
this.typeOptions = [
|
||||
{ name: i18nService.t("sendTypeFile"), value: SendType.File, premium: true },
|
||||
@@ -238,7 +238,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("sendDisabledWarning")
|
||||
this.i18nService.t("sendDisabledWarning"),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nameRequired")
|
||||
this.i18nService.t("nameRequired"),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("selectFile")
|
||||
this.i18nService.t("selectFile"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("maxFileSize")
|
||||
this.i18nService.t("maxFileSize"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode ? "editedSend" : "createdSend")
|
||||
this.i18nService.t(this.editMode ? "editedSend" : "createdSend"),
|
||||
);
|
||||
});
|
||||
try {
|
||||
@@ -424,7 +424,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
: null,
|
||||
defaultDeletionDateTime: this.datePipe.transform(
|
||||
new Date(this.send.deletionDate),
|
||||
"yyyy-MM-ddTHH:mm"
|
||||
"yyyy-MM-ddTHH:mm",
|
||||
),
|
||||
});
|
||||
|
||||
@@ -439,7 +439,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode ? "editedSend" : "createdSend")
|
||||
this.i18nService.t(this.editMode ? "editedSend" : "createdSend"),
|
||||
);
|
||||
} else {
|
||||
await this.dialogService.openSimpleDialog({
|
||||
@@ -471,7 +471,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
const now = new Date();
|
||||
const milliseconds = now.setTime(
|
||||
now.getTime() +
|
||||
(this.formGroup.controls.selectedExpirationDatePreset.value as number) * 60 * 60 * 1000
|
||||
(this.formGroup.controls.selectedExpirationDatePreset.value as number) * 60 * 60 * 1000,
|
||||
);
|
||||
return new Date(milliseconds).toString();
|
||||
}
|
||||
@@ -489,7 +489,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
const now = new Date();
|
||||
const milliseconds = now.setTime(
|
||||
now.getTime() +
|
||||
(this.formGroup.controls.selectedDeletionDatePreset.value as number) * 60 * 60 * 1000
|
||||
(this.formGroup.controls.selectedDeletionDatePreset.value as number) * 60 * 60 * 1000,
|
||||
);
|
||||
return new Date(milliseconds).toString();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export class SendComponent implements OnInit, OnDestroy {
|
||||
protected policyService: PolicyService,
|
||||
private logService: LogService,
|
||||
protected sendApiService: SendApiService,
|
||||
protected dialogService: DialogService
|
||||
protected dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -201,7 +201,7 @@ export class SendComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("sendLink"))
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("sendLink")),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("FormSelectionList", () => {
|
||||
beforeEach(() => {
|
||||
formSelectionList = new FormSelectionList<TestItemView, TestItemValue>(
|
||||
testControlFactory,
|
||||
testCompareFn
|
||||
testCompareFn,
|
||||
);
|
||||
testItems = [...initialTestItems];
|
||||
});
|
||||
@@ -148,15 +148,15 @@ describe("FormSelectionList", () => {
|
||||
|
||||
// Form array values should be in the same order
|
||||
expect(formSelectionList.formArray.value[0].id).toEqual(
|
||||
formSelectionList.selectedItems[0].id
|
||||
formSelectionList.selectedItems[0].id,
|
||||
);
|
||||
|
||||
expect(formSelectionList.formArray.value[1].id).toEqual(
|
||||
formSelectionList.selectedItems[1].id
|
||||
formSelectionList.selectedItems[1].id,
|
||||
);
|
||||
|
||||
expect(formSelectionList.formArray.value[2].id).toEqual(
|
||||
formSelectionList.selectedItems[2].id
|
||||
formSelectionList.selectedItems[2].id,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -180,7 +180,7 @@ describe("FormSelectionList", () => {
|
||||
|
||||
// Value and View should still be in sync
|
||||
expect(formSelectionList.formArray.value[0].id).toEqual(
|
||||
formSelectionList.selectedItems[0].id
|
||||
formSelectionList.selectedItems[0].id,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ function findSortedIndex<T>(sortedArray: T[], val: T, compareFn: (a: T, b: T) =>
|
||||
*/
|
||||
export class FormSelectionList<
|
||||
TItem extends SelectionItemId,
|
||||
TControlValue extends SelectionItemId
|
||||
TControlValue extends SelectionItemId,
|
||||
> {
|
||||
allItems: TItem[] = [];
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ export class FormSelectionList<
|
||||
*/
|
||||
constructor(
|
||||
private controlFactory: (item: TItem) => AbstractControl<Partial<TControlValue>, TControlValue>,
|
||||
private compareFn: (a: TItem, b: TItem) => number
|
||||
private compareFn: (a: TItem, b: TItem) => number,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ export class FormSelectionList<
|
||||
const sortedInsertIndex = findSortedIndex(
|
||||
this.deselectedItems,
|
||||
deselectedOption,
|
||||
this.compareFn
|
||||
this.compareFn,
|
||||
);
|
||||
|
||||
this.deselectedItems = [
|
||||
@@ -204,7 +204,7 @@ export class FormSelectionList<
|
||||
* @param fn - The function to call for each form control and its corresponding item
|
||||
*/
|
||||
forEachControlItem(
|
||||
fn: (control: AbstractControl<Partial<TControlValue>, TControlValue>, value: TItem) => void
|
||||
fn: (control: AbstractControl<Partial<TControlValue>, TControlValue>, value: TItem) => void,
|
||||
) {
|
||||
for (let i = 0; i < this.formArray.length; i++) {
|
||||
// The selectedItems array and formArray are explicitly kept in sync,
|
||||
|
||||
@@ -26,7 +26,7 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
||||
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private eventCollectionService: EventCollectionService
|
||||
private eventCollectionService: EventCollectionService,
|
||||
) {
|
||||
this.addFieldTypeOptions = [
|
||||
{ name: i18nService.t("cfTypeText"), value: FieldType.Text },
|
||||
@@ -78,7 +78,7 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
||||
if (this.editMode && f.showValue) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||
this.cipher.id
|
||||
this.cipher.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
||||
|
||||
const options: any = [];
|
||||
this.cipher.linkedFieldOptions.forEach((linkedFieldOption, id) =>
|
||||
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id })
|
||||
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id }),
|
||||
);
|
||||
this.linkedFieldOptions = options.sort(Utils.getSortFunction(this.i18nService, "name"));
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
protected passwordRepromptService: PasswordRepromptService,
|
||||
private organizationService: OrganizationService,
|
||||
protected sendApiService: SendApiService,
|
||||
protected dialogService: DialogService
|
||||
protected dialogService: DialogService,
|
||||
) {
|
||||
this.typeOptions = [
|
||||
{ name: i18nService.t("typeLogin"), value: CipherType.Login },
|
||||
@@ -171,7 +171,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.personalOwnershipPolicyAppliesToActiveUser = policyAppliesToActiveUser;
|
||||
await this.init();
|
||||
}),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
@@ -226,7 +226,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
if (this.editMode) {
|
||||
const cipher = await this.loadCipher();
|
||||
this.cipher = await cipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher),
|
||||
);
|
||||
|
||||
// Adjust Cipher Name if Cloning
|
||||
@@ -293,7 +293,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nameRequired")
|
||||
this.i18nService.t("nameRequired"),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("personalOwnershipSubmitError")
|
||||
this.i18nService.t("personalOwnershipSubmitError"),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode && !this.cloneMode ? "editedItem" : "addedItem")
|
||||
this.i18nService.t(this.editMode && !this.cloneMode ? "editedItem" : "addedItem"),
|
||||
);
|
||||
this.onSavedCipher.emit(this.cipher);
|
||||
this.messagingService.send(this.editMode && !this.cloneMode ? "editedCipher" : "addedCipher");
|
||||
@@ -424,11 +424,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.cipher.isDeleted ? "permanentlyDeletedItem" : "deletedItem")
|
||||
this.i18nService.t(this.cipher.isDeleted ? "permanentlyDeletedItem" : "deletedItem"),
|
||||
);
|
||||
this.onDeletedCipher.emit(this.cipher);
|
||||
this.messagingService.send(
|
||||
this.cipher.isDeleted ? "permanentlyDeletedCipher" : "deletedCipher"
|
||||
this.cipher.isDeleted ? "permanentlyDeletedCipher" : "deletedCipher",
|
||||
);
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
@@ -495,7 +495,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
if (this.editMode && this.showPassword) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledPasswordVisible,
|
||||
this.cipherId
|
||||
this.cipherId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -505,7 +505,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
if (this.showCardNumber) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledCardNumberVisible,
|
||||
this.cipherId
|
||||
this.cipherId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -516,7 +516,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
if (this.editMode && this.showCardCode) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledCardCodeVisible,
|
||||
this.cipherId
|
||||
this.cipherId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -537,7 +537,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
if (this.cipher.organizationId != null) {
|
||||
this.collections = this.writeableCollections.filter(
|
||||
(c) => c.organizationId === this.cipher.organizationId
|
||||
(c) => c.organizationId === this.cipher.organizationId,
|
||||
);
|
||||
const org = await this.organizationService.get(this.cipher.organizationId);
|
||||
if (org != null) {
|
||||
@@ -569,7 +569,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"warning",
|
||||
null,
|
||||
this.i18nService.t("passwordExposed", matches.toString())
|
||||
this.i18nService.t("passwordExposed", matches.toString()),
|
||||
);
|
||||
} else {
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("passwordSafe"));
|
||||
|
||||
@@ -41,7 +41,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
protected logService: LogService,
|
||||
protected stateService: StateService,
|
||||
protected fileDownloadService: FileDownloadService,
|
||||
protected dialogService: DialogService
|
||||
protected dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -55,7 +55,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("selectFile")
|
||||
this.i18nService.t("selectFile"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("maxFileSize")
|
||||
this.i18nService.t("maxFileSize"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
this.formPromise = this.saveCipherAttachment(files[0]);
|
||||
this.cipherDomain = await this.formPromise;
|
||||
this.cipher = await this.cipherDomain.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain),
|
||||
);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("attachmentSaved"));
|
||||
this.onUploadedAttachment.emit();
|
||||
@@ -130,7 +130,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("premiumRequired"),
|
||||
this.i18nService.t("premiumRequiredDesc")
|
||||
this.i18nService.t("premiumRequiredDesc"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
const attachmentDownloadResponse = await this.apiService.getAttachmentData(
|
||||
this.cipher.id,
|
||||
attachment.id,
|
||||
this.emergencyAccessId
|
||||
this.emergencyAccessId,
|
||||
);
|
||||
url = attachmentDownloadResponse.url;
|
||||
} catch (e) {
|
||||
@@ -182,7 +182,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
protected async init() {
|
||||
this.cipherDomain = await this.loadCipher();
|
||||
this.cipher = await this.cipherDomain.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain),
|
||||
);
|
||||
|
||||
const canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||
@@ -231,10 +231,10 @@ export class AttachmentsComponent implements OnInit {
|
||||
this.cipherDomain,
|
||||
attachment.fileName,
|
||||
decBuf,
|
||||
admin
|
||||
admin,
|
||||
);
|
||||
this.cipher = await this.cipherDomain.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain),
|
||||
);
|
||||
|
||||
// 3. Delete old
|
||||
@@ -251,7 +251,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("attachmentSaved")
|
||||
this.i18nService.t("attachmentSaved"),
|
||||
);
|
||||
this.onReuploadedAttachment.emit();
|
||||
} catch (e) {
|
||||
|
||||
@@ -33,7 +33,7 @@ export class FolderAddEditComponent implements OnInit {
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected logService: LogService,
|
||||
protected dialogService: DialogService,
|
||||
protected formBuilder: FormBuilder
|
||||
protected formBuilder: FormBuilder,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -46,7 +46,7 @@ export class FolderAddEditComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nameRequired")
|
||||
this.i18nService.t("nameRequired"),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export class FolderAddEditComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode ? "editedFolder" : "addedFolder")
|
||||
this.i18nService.t(this.editMode ? "editedFolder" : "addedFolder"),
|
||||
);
|
||||
this.onSavedFolder.emit(this.folder);
|
||||
return true;
|
||||
|
||||
@@ -35,7 +35,7 @@ export class IconComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private environmentService: EnvironmentService,
|
||||
private settingsService: SettingsService
|
||||
private settingsService: SettingsService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
|
||||
@@ -14,7 +14,7 @@ export class PasswordHistoryComponent implements OnInit {
|
||||
protected cipherService: CipherService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected i18nService: I18nService,
|
||||
private win: Window
|
||||
private win: Window,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -27,14 +27,14 @@ export class PasswordHistoryComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"info",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("password"))
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("password")),
|
||||
);
|
||||
}
|
||||
|
||||
protected async init() {
|
||||
const cipher = await this.cipherService.get(this.cipherId);
|
||||
const decCipher = await cipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher),
|
||||
);
|
||||
this.history = decCipher.passwordHistory == null ? [] : decCipher.passwordHistory;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class PremiumComponent implements OnInit {
|
||||
private logService: LogService,
|
||||
protected stateService: StateService,
|
||||
protected dialogService: DialogService,
|
||||
private environmentService: EnvironmentService
|
||||
private environmentService: EnvironmentService,
|
||||
) {
|
||||
this.cloudWebVaultUrl = this.environmentService.getCloudWebVaultUrl();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,10 @@ export class VaultItemsComponent {
|
||||
this._searchText = value;
|
||||
}
|
||||
|
||||
constructor(protected searchService: SearchService, protected cipherService: CipherService) {}
|
||||
constructor(
|
||||
protected searchService: SearchService,
|
||||
protected cipherService: CipherService,
|
||||
) {}
|
||||
|
||||
async load(filter: (cipher: CipherView) => boolean = null, deleted = false) {
|
||||
this.deleted = deleted ?? false;
|
||||
@@ -97,7 +100,7 @@ export class VaultItemsComponent {
|
||||
this.ciphers = await this.searchService.searchCiphers(
|
||||
this.searchText,
|
||||
[this.filter, this.deletedFilter],
|
||||
indexedCiphers
|
||||
indexedCiphers,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ViewCustomFieldsComponent {
|
||||
if (f.showValue) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||
this.cipher.id
|
||||
this.cipher.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
private logService: LogService,
|
||||
protected stateService: StateService,
|
||||
protected fileDownloadService: FileDownloadService,
|
||||
protected dialogService: DialogService
|
||||
protected dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -115,7 +115,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
|
||||
const cipher = await this.cipherService.get(this.cipherId);
|
||||
this.cipher = await cipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher),
|
||||
);
|
||||
this.canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||
this.showPremiumRequiredTotp =
|
||||
@@ -208,7 +208,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.cipher.isDeleted ? "permanentlyDeletedItem" : "deletedItem")
|
||||
this.i18nService.t(this.cipher.isDeleted ? "permanentlyDeletedItem" : "deletedItem"),
|
||||
);
|
||||
this.onDeletedCipher.emit(this.cipher);
|
||||
} catch (e) {
|
||||
@@ -244,7 +244,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
if (this.showPassword) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledPasswordVisible,
|
||||
this.cipherId
|
||||
this.cipherId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
if (this.showCardNumber) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledCardNumberVisible,
|
||||
this.cipherId
|
||||
this.cipherId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
if (this.showCardCode) {
|
||||
this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledCardCodeVisible,
|
||||
this.cipherId
|
||||
this.cipherId,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"warning",
|
||||
null,
|
||||
this.i18nService.t("passwordExposed", matches.toString())
|
||||
this.i18nService.t("passwordExposed", matches.toString()),
|
||||
);
|
||||
} else {
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("passwordSafe"));
|
||||
@@ -337,7 +337,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"info",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t(typeI18nKey))
|
||||
this.i18nService.t("valueCopied", this.i18nService.t(typeI18nKey)),
|
||||
);
|
||||
|
||||
if (typeI18nKey === "password") {
|
||||
@@ -368,7 +368,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("premiumRequired"),
|
||||
this.i18nService.t("premiumRequiredDesc")
|
||||
this.i18nService.t("premiumRequiredDesc"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
try {
|
||||
const attachmentDownloadResponse = await this.apiService.getAttachmentData(
|
||||
this.cipher.id,
|
||||
attachment.id
|
||||
attachment.id,
|
||||
);
|
||||
url = attachmentDownloadResponse.url;
|
||||
} catch (e) {
|
||||
|
||||
@@ -30,7 +30,7 @@ export class VaultFilterService implements DeprecatedVaultFilterServiceAbstracti
|
||||
protected folderService: FolderService,
|
||||
protected cipherService: CipherService,
|
||||
protected collectionService: CollectionService,
|
||||
protected policyService: PolicyService
|
||||
protected policyService: PolicyService,
|
||||
) {}
|
||||
|
||||
async storeCollapsedFilterNodes(collapsedFilterNodes: Set<string>): Promise<void> {
|
||||
@@ -62,7 +62,7 @@ export class VaultFilterService implements DeprecatedVaultFilterServiceAbstracti
|
||||
const ciphers = await this.cipherService.getAllDecrypted();
|
||||
const orgCiphers = ciphers.filter((c) => c.organizationId == organizationId);
|
||||
folders = storedFolders.filter(
|
||||
(f) => orgCiphers.some((oc) => oc.folderId == f.id) || f.id == null
|
||||
(f) => orgCiphers.some((oc) => oc.folderId == f.id) || f.id == null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export class VaultFilterService implements DeprecatedVaultFilterServiceAbstracti
|
||||
};
|
||||
|
||||
return this.folderService.folderViews$.pipe(
|
||||
mergeMap((folders) => from(transformation(folders)))
|
||||
mergeMap((folders) => from(transformation(folders))),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,13 +95,13 @@ export class VaultFilterService implements DeprecatedVaultFilterServiceAbstracti
|
||||
|
||||
async checkForSingleOrganizationPolicy(): Promise<boolean> {
|
||||
return await firstValueFrom(
|
||||
this.policyService.policyAppliesToActiveUser$(PolicyType.SingleOrg)
|
||||
this.policyService.policyAppliesToActiveUser$(PolicyType.SingleOrg),
|
||||
);
|
||||
}
|
||||
|
||||
async checkForPersonalOwnershipPolicy(): Promise<boolean> {
|
||||
return await firstValueFrom(
|
||||
this.policyService.policyAppliesToActiveUser$(PolicyType.PersonalOwnership)
|
||||
this.policyService.policyAppliesToActiveUser$(PolicyType.PersonalOwnership),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ export class VaultFilterService implements DeprecatedVaultFilterServiceAbstracti
|
||||
|
||||
async getFolderNested(id: string): Promise<TreeNode<FolderView>> {
|
||||
const folders = await this.getAllFoldersNested(
|
||||
await firstValueFrom(this.folderService.folderViews$)
|
||||
await firstValueFrom(this.folderService.folderViews$),
|
||||
);
|
||||
return ServiceUtils.getTreeNodeObjectFromList(folders, id) as TreeNode<FolderView>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user