changed: use prompt instead of authent page

This commit is contained in:
quenousimporte 2023-10-27 13:31:32 +02:00
parent ca4a54f36a
commit cc0b0ad328
3 changed files with 10 additions and 52 deletions

View File

@ -22,13 +22,6 @@
<div id="network"></div>
</div>
<div id="authentpage" hidden>
<div id="bigtitle">notes</div>
<div>
<input id="password" type="password" placeholder="pass phrase..." onkeydown="sendpassword()" onblur="sendpassword()" ></input>
</div>
</div>
<div id="searchdialog" oninput="applyfilter()" hidden>
<div>
<input id="filter" placeholder="search..." autocomplete="off"></input>

48
main.js
View File

@ -15,7 +15,8 @@ var defaultsettings =
titlebydefault: false,
linksinnewtab: true,
colors: true,
bulletrendering: "•"
bulletrendering: "•",
password: ""
};
//builtin
@ -128,10 +129,6 @@ var commands = [
action: searchtags,
shortcut: "ctrl+shift+T"
},
{
hint: "Log out",
action: logout,
},
{
hint: "Toggle split view",
action: togglesplit
@ -993,15 +990,6 @@ function isremote()
return currentvault == "remote";
}
function logout()
{
if (isremote())
{
window.localStorage.removeItem("password");
togglepassword();
}
}
function tagslist()
{
tags = {};
@ -1340,7 +1328,12 @@ function init()
window.localStorage.setItem("remote", JSON.stringify(data));
loadstorage();
})
.catch(remotecallfailed);
.catch(err =>
{
settings.password = prompt("Password: ", settings.password);
savesettings();
init();
});
}
else
{
@ -1367,15 +1360,6 @@ function init()
}
}
function togglepassword()
{
password.value = "";
authentpage.hidden = false;
notepage.style.display = "none";
document.title = "notes";
password.focus();
}
function cvdt(text)
{
var day = text.substr(0,8);
@ -1445,7 +1429,7 @@ function queryremote(params)
stat.cur.q++;
stat.ses.q++;
params.password = window.localStorage.getItem("password");
params.password = settings.password;
var paramlist = [];
for (var i in params)
@ -1484,8 +1468,7 @@ function queryremote(params)
{
if (data.error == "authent")
{
failed();
togglepassword();
failed("Authent failed");
}
else
{
@ -1498,7 +1481,6 @@ function queryremote(params)
}
else
{
authentpage.hidden = true;
notepage.style.display = "table";
apply(data);
}
@ -2846,16 +2828,6 @@ function loadnote(name)
}
}
function sendpassword()
{
if (!authentpage.hidden && (event.type == "blur" || event.key == "Enter"))
{
event.preventDefault();
window.localStorage.setItem("password", password.value);
init();
}
}
function focuseditor()
{
if (document.documentElement == event.srcElement)

View File

@ -132,10 +132,3 @@ body::-webkit-scrollbar-thumb {
background-color: darkgray;
margin: 2px 2px 2px 2px;
}
/* authent */
#bigtitle {
font-size: 50px;
line-height: 100%;
}