A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: fix app lock verification always succeeds
Abdullah Attaff0188f60230
diff --git a/apps/web/src/dialogs/settings/app-lock-settings.ts b/apps/web/src/dialogs/settings/app-lock-settings.tsindex 9705b2826..94660cc32 100644--- a/apps/web/src/dialogs/settings/app-lock-settings.ts+++ b/apps/web/src/dialogs/settings/app-lock-settings.ts@@ -27,7 +27,8 @@ import {CredentialType,CredentialWithSecret,CredentialWithoutSecret,- useKeyStore+ useKeyStore,+ wrongCredentialError} from "../../interfaces/key-store";import { showToast } from "../../utils/toast";import { WebAuthn } from "../../utils/webauthn";@@ -412,7 +413,8 @@ async function authenticateAppLock() {if (!defaultCredential) {return verifyAccount();}- return !!(await verifyCredential(defaultCredential, (c) =>- useKeyStore.getState().verifyCredential(c)- ));+ return !!(await verifyCredential(defaultCredential, async (c) => {+ if (!(await useKeyStore.getState().verifyCredential(c)))+ throw new Error(wrongCredentialError(c));+ }));}diff --git a/apps/web/src/interfaces/key-store.ts b/apps/web/src/interfaces/key-store.tsindex b009bf0ea..122272958 100644--- a/apps/web/src/interfaces/key-store.ts+++ b/apps/web/src/interfaces/key-store.ts@@ -513,7 +513,7 @@ function deserializeCredential(throw new Error("Credentials are of different types.");}-function wrongCredentialError(query: CredentialQuery): string {+export function wrongCredentialError(query: CredentialQuery): string {switch (query.type) {case "password":return "Wrong password";