1
0
mirror of https://github.com/bitwarden/browser synced 2026-03-02 03:21:19 +00:00

feat(change-password-component): Change Password Update [18720] - Minor fixes.

This commit is contained in:
Patrick Pimentel
2025-06-11 21:19:46 -06:00
parent 0e2d6f0a06
commit 7bae3d9f6b
7 changed files with 23 additions and 10 deletions

View File

@@ -43,7 +43,7 @@ export class ChangePasswordComponent implements OnInit {
@Input() inputPasswordFlow: InputPasswordFlow = InputPasswordFlow.ChangePassword;
activeAccount: Account | null = null;
email!: string;
email?: string;
userId?: UserId;
masterPasswordPolicyOptions?: MasterPasswordPolicyOptions;
initializing = true;
@@ -157,8 +157,7 @@ export class ChangePasswordComponent implements OnInit {
this.toastService.showToast({
variant: "success",
title: this.i18nService.t("masterPasswordChanged"),
message: this.i18nService.t("masterPasswordChangedDesc"),
message: this.i18nService.t("masterPasswordChanged"),
});
this.messagingService.send("logout");

View File

@@ -32,7 +32,10 @@ export abstract class ChangePasswordService {
* @param userId the `userId`
* @throws if the `userId`, `currentMasterKey`, or `currentServerMasterKeyHash` is not found
*/
abstract changePassword(passwordInputResult: PasswordInputResult, userId: UserId): Promise<void>;
abstract changePassword(
passwordInputResult: PasswordInputResult,
userId: UserId | null,
): Promise<void>;
/**
* Changes the user's password and re-encrypts the user key with the `newMasterKey`.

View File

@@ -27,7 +27,7 @@ export class DefaultChangePasswordService implements ChangePasswordService {
private async preparePasswordChange(
passwordInputResult: PasswordInputResult,
userId: UserId,
userId: UserId | null,
): Promise<[UserKey, EncString]> {
if (!userId) {
throw new Error("userId not found");
@@ -51,7 +51,7 @@ export class DefaultChangePasswordService implements ChangePasswordService {
);
}
async changePassword(passwordInputResult: PasswordInputResult, userId: UserId) {
async changePassword(passwordInputResult: PasswordInputResult, userId: UserId | null) {
const newMasterKeyEncryptedUserKey = await this.preparePasswordChange(
passwordInputResult,
userId,