Skip to content

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

feat: ask for pwd before showing recovery key

thecodrraa760c608d77
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.js
index 2095ba7a8..63eefa43a 100644
--- a/apps/web/src/common/dialogcontroller.js
+++ b/apps/web/src/common/dialogcontroller.js
@@ -410,6 +410,12 @@ function getDialogData(type) {
"All your data will be re-encrypted and synced with the new password.",
positiveButtonText: "Change password",
};
+ case "verify_account":
+ return {
+ title: "Verify it's you",
+ subtitle: "Enter your account password to proceed.",
+ positiveButtonText: "Verify",
+ };
case "delete_account":
return {
title: "Delete your account",
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index dfc67b28a..4cd1c7d44 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -10,7 +10,12 @@ import accents from "../theme/accents";
import { confirm, showLogInDialog } from "../common/dialog-controller";
import { showLogoutConfirmation } from "../common/dialog-controller";
import useSystemTheme from "../utils/use-system-theme";
-import { createBackup, isUserPremium, SUBSCRIPTION_STATUS } from "../common";
+import {
+ createBackup,
+ isUserPremium,
+ SUBSCRIPTION_STATUS,
+ verifyAccount,
+} from "../common";
import { db } from "../common/db";
import { usePersistentState } from "../utils/hooks";
import dayjs from "dayjs";
@@ -173,7 +178,12 @@ function Settings(props) {
)}
{isLoggedIn && (
<>
- <Button variant="list" onClick={showRecoveryKeyDialog}>
+ <Button
+ variant="list"
+ onClick={async () => {
+ if (await verifyAccount()) await showRecoveryKeyDialog();
+ }}
+ >
<Tip
text="Backup data recovery key"
tip="In case you lose your password, you can recover your data using your recovery key."