Skip to content

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

fix: confirm before logging out from all devices

thecodrr578d58aab5ce
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.js
index c924d6455..a768b22da 100644
--- a/apps/web/src/common/dialogcontroller.js
+++ b/apps/web/src/common/dialogcontroller.js
@@ -183,6 +183,16 @@ export function showLogoutConfirmation() {
});
}
+export function showClearSessionsConfirmation() {
+ return confirm({
+ title: `Logout from other devices?`,
+ message:
+ "All other logged-in devices will be forced to logout stopping sync. Use with care lest you lose important notes.",
+ yesText: `Yes`,
+ noText: "No",
+ });
+}
+
// export function showAccountDeletedNotice() {
// return confirm(Icon.Logout, {
// title: `Account deleted`,
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 5094aa3cb..ea0297f22 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -13,18 +13,19 @@ import {
showImportDialog,
showIssueDialog,
showTrackingDetailsDialog,
+ showClearSessionsConfirmation,
+ showLogoutConfirmation,
+ showRecoveryKeyDialog,
+ showLoadingDialog,
+ showBuyDialog,
+ showPasswordDialog,
} from "../common/dialog-controller";
-import { showLogoutConfirmation } from "../common/dialog-controller";
import { createBackup, SUBSCRIPTION_STATUS, verifyAccount } from "../common";
import { db } from "../common/db";
import { usePersistentState } from "../utils/hooks";
import dayjs from "dayjs";
-import { showRecoveryKeyDialog } from "../common/dialog-controller";
-import { showBuyDialog } from "../common/dialog-controller";
import ScrollContainer from "../components/scroll-container";
-import { showLoadingDialog } from "../common/dialog-controller";
import { showToast } from "../utils/toast";
-import { showPasswordDialog } from "../common/dialog-controller";
import { hardNavigate, hashNavigate } from "../navigation";
import { appVersion } from "../utils/version";
import { CHECK_IDS } from "notes-core/common";
@@ -640,6 +641,8 @@ function Settings(props) {
<Button
variant="list"
onClick={async () => {
+ if (!(await showClearSessionsConfirmation())) return;
+
await db.user.clearSessions();
await showToast(
"success",