mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +00:00
add handleMigrateEncryptionKey to default and web service
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
import { UrlTree } from "@angular/router";
|
||||
|
||||
import { AuthResult } from "@bitwarden/common/auth/models/domain/auth-result";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { ToastService } from "@bitwarden/components";
|
||||
|
||||
import { LoginService, PasswordPolicies } from "./login.service";
|
||||
|
||||
export class DefaultLoginService implements LoginService {
|
||||
constructor(
|
||||
protected i18nService: I18nService,
|
||||
protected toastService: ToastService,
|
||||
) {}
|
||||
|
||||
getShowPasswordlessFlag(): boolean {
|
||||
return null;
|
||||
}
|
||||
@@ -14,4 +23,18 @@ export class DefaultLoginService implements LoginService {
|
||||
async getOrgPolicies(): Promise<PasswordPolicies | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Legacy accounts used the master key to encrypt data. Migration is required but only performed on web
|
||||
async handleMigrateEncryptionKey(result: AuthResult): Promise<boolean> {
|
||||
if (!result.requiresEncryptionKeyMigration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: this.i18nService.t("errorOccured"),
|
||||
message: this.i18nService.t("encryptionKeyMigrationRequired"),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user