Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: canceling backup on password change should abort

Abdullah Atta2d4d656dd900
diff --git a/apps/web/src/common/index.ts b/apps/web/src/common/index.ts
index 591edef89..49ee45367 100644
--- a/apps/web/src/common/index.ts
+++ b/apps/web/src/common/index.ts
@@ -85,7 +85,7 @@ export async function createBackup(rescueMode = false) {
const verified = rescueMode || encryptBackups || (await verifyAccount());
if (!verified) {
showToast("error", "Could not create a backup: user verification failed.");
- return;
+ return false;
}
const encryptedBackups = !rescueMode && isLoggedIn && encryptBackups;
@@ -139,7 +139,9 @@ export async function createBackup(rescueMode = false) {
console.error(error);
} else {
showToast("success", `Backup saved at ${filePath}.`);
+ return true;
}
+ return false;
}
export async function selectBackupFile() {
diff --git a/apps/web/src/dialogs/settings/auth-settings.ts b/apps/web/src/dialogs/settings/auth-settings.ts
index 88228d1ef..86bb8a416 100644
--- a/apps/web/src/dialogs/settings/auth-settings.ts
+++ b/apps/web/src/dialogs/settings/auth-settings.ts
@@ -46,7 +46,7 @@ export const AuthenticationSettings: SettingsGroup[] = [
title: "Change password",
variant: "secondary",
action: async () => {
- await createBackup();
+ if (!(await createBackup())) return;
const result = await showPasswordDialog({
title: "Change account password",
message: `All your data will be re-encrypted and synced with the new password.