Skip to content

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

web: create backup before changing password

Abdullah Attaaf7120e953e3
diff --git a/apps/web/src/dialogs/password-dialog.jsx b/apps/web/src/dialogs/password-dialog.jsx
index cb6e48c1f..a0486cf67 100644
--- a/apps/web/src/dialogs/password-dialog.jsx
+++ b/apps/web/src/dialogs/password-dialog.jsx
@@ -63,7 +63,11 @@ function PasswordDialog(props) {
loading: isLoading,
disabled: isLoading
}}
- negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
+ negativeButton={{
+ text: "Cancel",
+ onClick: () => props.onClose(false),
+ disabled: isLoading
+ }}
>
<Box
id="passwordForm"
diff --git a/apps/web/src/dialogs/settings/auth-settings.ts b/apps/web/src/dialogs/settings/auth-settings.ts
index b52e41ae6..45754e07d 100644
--- a/apps/web/src/dialogs/settings/auth-settings.ts
+++ b/apps/web/src/dialogs/settings/auth-settings.ts
@@ -19,11 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { SettingsGroup } from "./types";
import { useStore as useUserStore } from "../../stores/user-store";
-import { verifyAccount } from "../../common";
+import { createBackup, verifyAccount } from "../../common";
import {
show2FARecoveryCodesDialog,
showMultifactorDialog,
- showPasswordDialog
+ showPasswordDialog,
+ showRecoveryKeyDialog
} from "../../common/dialog-controller";
import { db } from "../../common/db";
import { showToast } from "../../utils/toast";
@@ -45,19 +46,22 @@ export const AuthenticationSettings: SettingsGroup[] = [
title: "Change password",
variant: "secondary",
action: async () => {
+ await createBackup();
const result = await showPasswordDialog(
"change_account_password",
async (data) => {
- await db.user?.clearSessions();
return (
- db.user?.changePassword(
+ (await db.user?.changePassword(
data.oldPassword,
data.newPassword
- ) || false
+ )) || false
);
}
);
- if (result) showToast("success", "Account password changed!");
+ if (result) {
+ showToast("success", "Account password changed!");
+ await showRecoveryKeyDialog();
+ }
}
}
]