Check MasterPassword in web app during change (#8293)

This commit is contained in:
Timshel 2024-05-08 18:24:18 +02:00 committed by GitHub
parent 7d5575882e
commit 350ad890de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -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,