Skip to content

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

feat: prevent silent access on logout

thecodrr90727105d1f0
diff --git a/apps/web/src/components/dialogs/logindialog.js b/apps/web/src/components/dialogs/logindialog.js
index c5386f87a..6c81afa41 100644
--- a/apps/web/src/components/dialogs/logindialog.js
+++ b/apps/web/src/components/dialogs/logindialog.js
@@ -15,16 +15,20 @@ function LoginDialog(props) {
useEffect(() => {
if (!window.PasswordCredential) return;
(async function () {
- navigator.credentials
- .get({ mediation: "silent", password: true })
- .then(async (credential) => {
- if (credential) {
- await login({
- username: credential.id,
- password: credential.password,
- });
- }
+ console.log("Trying to automatically login...");
+ const credential = await navigator.credentials.get({
+ mediation: "silent",
+ password: true,
+ });
+ if (credential) {
+ console.log("Got credentials...");
+ await login({
+ username: credential.id,
+ password: credential.password,
});
+ } else {
+ console.log("Did not get credentials...");
+ }
})();
}, [login]);
return (
@@ -83,6 +87,7 @@ function LoginDialog(props) {
password: data.password,
});
await navigator.credentials.store(c);
+ console.log("Credentails stored...");
onClose();
} else {
onClose();
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 4defc5f06..5dc702829 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -190,7 +190,11 @@ function Settings(props) {
<Button
variant="list"
onClick={async () => {
- if (await showLogoutConfirmation()) await logout();
+ if (await showLogoutConfirmation()) {
+ if (window.PasswordCredential)
+ await navigator.credentials.preventSilentAccess();
+ await logout();
+ }
}}
>
<TextWithTip