mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
web: fix app lock verification always succeeds
This commit is contained in:
@@ -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));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user