From 7d2a364d1649bf80c932d4c633ab9285188319df Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:34:48 -0700 Subject: [PATCH] move sync to after checks --- .../change-password/change-password.component.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/auth/src/angular/change-password/change-password.component.ts b/libs/auth/src/angular/change-password/change-password.component.ts index 6f80c60e221..43a9e0d89ce 100644 --- a/libs/auth/src/angular/change-password/change-password.component.ts +++ b/libs/auth/src/angular/change-password/change-password.component.ts @@ -85,14 +85,8 @@ export class ChangePasswordComponent implements OnInit { } private async submitNew(passwordInputResult: PasswordInputResult) { - if (passwordInputResult.currentPassword == null) { - throw new Error("Invalid current password credential(s)"); - } - try { if (passwordInputResult.rotateUserKey) { - await this.syncService.fullSync(true); - if (this.activeAccount == null) { throw new Error("activeAccount not found"); } @@ -101,6 +95,8 @@ export class ChangePasswordComponent implements OnInit { throw new Error("currentPassword not found"); } + await this.syncService.fullSync(true); + await this.changePasswordService.rotateUserKeyMasterPasswordAndEncryptedData( passwordInputResult.currentPassword, passwordInputResult.newPassword, @@ -137,7 +133,7 @@ export class ChangePasswordComponent implements OnInit { } if (passwordInputResult.currentServerMasterKeyHash == null) { - throw new Error("Invalid current password credentials"); + throw new Error("currentServerMasterKeyHash not found"); } if (passwordInputResult.rotateUserKey) {