From 3122e8a3792b6cb4ce501740fd3547bf5b60fd33 Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:07:48 +0500 Subject: [PATCH 1/7] web: don't ask for account password for vault deletion for not logged in users Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- apps/web/src/common/vault.ts | 57 ++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/apps/web/src/common/vault.ts b/apps/web/src/common/vault.ts index 39ef84cd5..b5f2bc862 100644 --- a/apps/web/src/common/vault.ts +++ b/apps/web/src/common/vault.ts @@ -23,6 +23,7 @@ import { showToast } from "../utils/toast"; import { VAULT_ERRORS } from "@notesnook/core"; import { strings } from "@notesnook/intl"; import { useStore as useAppStore } from "../stores/app-store"; +import { useStore as useUserStore } from "../stores/user-store"; class Vault { static async createVault() { @@ -63,29 +64,47 @@ class Vault { static async deleteVault() { if (!(await db.vault.exists())) return false; - const result = await showPasswordDialog({ - title: strings.deleteVault(), - subtitle: strings.deleteVaultDesc(), - inputs: { - password: { - label: strings.accountPassword(), - autoComplete: "current-password" - } - }, - checks: { - deleteAllLockedNotes: { - text: strings.deleteAllNotes(), - default: false - } - }, - validate: ({ password }) => { - return db.user.verifyPassword(password); - } - }); + + const result = await (useUserStore.getState().isLoggedIn + ? showPasswordDialog({ + title: strings.deleteVault(), + subtitle: strings.deleteVaultDesc(), + inputs: { + password: { + label: strings.accountPassword(), + autoComplete: "current-password" + } + }, + checks: { + deleteAllLockedNotes: { + text: strings.deleteAllNotes(), + default: false + } + }, + validate: ({ password }) => { + return db.user.verifyPassword(password); + } + }) + : showPasswordDialog({ + title: strings.deleteVault(), + subtitle: strings.deleteVaultDesc(), + inputs: {}, + checks: { + deleteAllLockedNotes: { + text: strings.deleteAllNotes(), + default: false + } + }, + validate: () => { + return Promise.resolve(true); + } + })); + if (result) { await db.vault.delete(result.deleteAllLockedNotes); return true; } + return false; } From 4f884a84116fef452d42ac52f0732525ed6157eb Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Thu, 4 Jun 2026 12:27:07 +0500 Subject: [PATCH 2/7] mobile: do not ask for password on vault deletion if user not logged in --- .../app/components/dialogs/vault/index.tsx | 22 ++++++++++++++----- packages/intl/locale/en.po | 4 ++-- packages/intl/locale/pseudo-LOCALE.po | 2 +- packages/intl/src/strings.ts | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/mobile/app/components/dialogs/vault/index.tsx b/apps/mobile/app/components/dialogs/vault/index.tsx index 57266e2d3..d7d096087 100644 --- a/apps/mobile/app/components/dialogs/vault/index.tsx +++ b/apps/mobile/app/components/dialogs/vault/index.tsx @@ -66,12 +66,14 @@ import { VAULT_ERRORS } from "@notesnook/core"; import { useThemeColors } from "@notesnook/theme"; +import { useUserStore } from "../../../stores/use-user-store"; export const VaultDialog: React.FC = () => { const { colors } = useThemeColors(); // UI State const [visible, setVisible] = useState(false); + const isUserLoggedIn = useUserStore((state) => !!state.user); const [loading, setLoading] = useState(false); const [deleteAll, setDeleteAll] = useState(false); const [biometricUnlock, setBiometricUnlock] = useState(false); @@ -196,9 +198,12 @@ export const VaultDialog: React.FC = () => { } eSendEvent("vaultUpdated"); setLoading(false); - setTimeout(() => { - close(); - }, 100); + close(); + ToastManager.show({ + message: strings.vaultDeleted(), + type: "success", + context: "global" + }); } else { setLoading(false); formRef.current.setError("password", strings.passwordIncorrect()); @@ -489,6 +494,13 @@ export const VaultDialog: React.FC = () => { const { password, newPassword } = formRef.current.getValues(); + if (requestType === VaultRequestType.DeleteVault && !isUserLoggedIn) { + setLoading(true); + await deleteVault(); + setLoading(false); + return; + } + if (requestType === VaultRequestType.CreateVault) { createVault(); } else if (requestType === VaultRequestType.ChangePassword) { @@ -700,7 +712,6 @@ export const VaultDialog: React.FC = () => { icon="shield" padding={12} /> - { > {(isChangePassword || isClearVault || - !isCreateVault || - isDeleteVault || + (isDeleteVault && isUserLoggedIn) || isCustomAction) && !isRevokeFingerprint ? ( <> diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index 8abcecd03..13ef67ae0 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -2209,8 +2209,8 @@ msgid "Delete mode" msgstr "Delete mode" #: src/strings.ts:562 -msgid "Delete notes in this vault" -msgstr "Delete notes in this vault" +msgid "Delete notes in this vault permanently" +msgstr "Delete notes in this vault permanently" #: src/strings.ts:569 msgid "Delete permanently" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index 1c6b1e689..c99b379f2 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -2198,7 +2198,7 @@ msgid "Delete mode" msgstr "" #: src/strings.ts:562 -msgid "Delete notes in this vault" +msgid "Delete notes in this vault permanently" msgstr "" #: src/strings.ts:569 diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index 9e6a052e6..cc7020bdd 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -559,7 +559,7 @@ $day$: Current day (eg. Monday)`, couldNotUnlock: () => t`Could not unlock`, unlockNoteDesc: () => t`Your note will be unencrypted and removed from the vault.`, - deleteAllNotes: () => t`Delete notes in this vault`, + deleteAllNotes: () => t`Delete notes in this vault permanently`, getStarted: () => t`Get started`, saveACopy: () => t`Save a copy`, discard: () => t`Discard`, From 1d292d740c33a143251bdb210e5a924c61ed51a3 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Thu, 11 Jun 2026 19:46:32 +0500 Subject: [PATCH 3/7] mobile: fix vault asks for fingerprint permission on creating vault --- apps/mobile/app/components/dialogs/vault/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/mobile/app/components/dialogs/vault/index.tsx b/apps/mobile/app/components/dialogs/vault/index.tsx index d7d096087..3a7c1e53a 100644 --- a/apps/mobile/app/components/dialogs/vault/index.tsx +++ b/apps/mobile/app/components/dialogs/vault/index.tsx @@ -641,16 +641,22 @@ export const VaultDialog: React.FC = () => { // Auto-unlock with fingerprint if applicable const canAutoUnlock = fingerprint && + available && data.requestType !== VaultRequestType.EnableFingerprint && data.requestType !== VaultRequestType.RevokeFingerprint && data.requestType !== VaultRequestType.ChangePassword && data.requestType !== VaultRequestType.ClearVault && data.requestType !== VaultRequestType.DeleteVault && data.requestType !== VaultRequestType.CustomAction && - data.requestType !== VaultRequestType.PermanentUnlock; + data.requestType !== VaultRequestType.PermanentUnlock && + data.requestType !== VaultRequestType.CreateVault; - if (canAutoUnlock) { - await onPressFingerprintAuth(data.title, data.description); + if (canAutoUnlock && available) { + try { + await onPressFingerprintAuth(data.title, data.description); + } catch (e) { + setVisible(true); + } } else { setVisible(true); } From 7af138769198d568df9ca9016f3ba91751efc5ed Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Wed, 17 Jun 2026 09:18:21 +0500 Subject: [PATCH 4/7] mobile: fix delete all notes check truncated --- .../app/components/dialogs/vault/index.tsx | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/apps/mobile/app/components/dialogs/vault/index.tsx b/apps/mobile/app/components/dialogs/vault/index.tsx index 3a7c1e53a..4c4be4cd3 100644 --- a/apps/mobile/app/components/dialogs/vault/index.tsx +++ b/apps/mobile/app/components/dialogs/vault/index.tsx @@ -67,6 +67,9 @@ import { } from "@notesnook/core"; import { useThemeColors } from "@notesnook/theme"; import { useUserStore } from "../../../stores/use-user-store"; +import { AppFontSize } from "../../../utils/size"; +import { Pressable } from "../../ui/pressable"; +import AppIcon from "../../ui/AppIcon"; export const VaultDialog: React.FC = () => { const { colors } = useThemeColors(); @@ -788,20 +791,30 @@ export const VaultDialog: React.FC = () => { ) : null} {isDeleteVault && ( -