Skip to content

Commit

Permalink
Check MasterPassword in web app during change (#8293)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timshel committed May 8, 2024
1 parent 7d55758 commit 350ad89
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apps/web/src/app/auth/settings/change-password.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,22 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
newMasterKey: MasterKey,
newUserKey: [UserKey, EncString],
) {
const masterKey = await this.cryptoService.getOrDeriveMasterKey(this.currentMasterPassword);
const masterKey = await this.cryptoService.makeMasterKey(
this.currentMasterPassword,
await this.stateService.getEmail(),
await this.kdfConfigService.getKdfConfig(),
);

const userKey = await this.cryptoService.decryptUserKeyWithMasterKey(masterKey);
if (userKey == null) {
this.platformUtilsService.showToast(
"error",
null,
this.i18nService.t("invalidMasterPassword"),
);
return;
}

const request = new PasswordRequest();
request.masterPasswordHash = await this.cryptoService.hashMasterKey(
this.currentMasterPassword,
Expand Down

0 comments on commit 350ad89

Please sign in to comment.