minor fixes

This commit is contained in:
Jon Dough
2024-04-05 07:05:26 +00:00
parent ddf88ed2fc
commit c457119b95
4 changed files with 33 additions and 11 deletions

View File

@@ -7,7 +7,7 @@
</head>
<body>
<div id="main">
<input id="master-password" type="password">
<input id="master-password" type="password" onkeydown="detect_enter(event)">
<button onclick="get_passwords()">get</button>
<br>
<span id="computed"></span>
@@ -15,10 +15,6 @@
<span id="computed2"></span>
</div>
<script>
function get_passwords() {
get_password(new Date(), "computed");
get_password(new Date((new Date()).getTime() + 24 * 60 * 60 * 1000), "computed2");
}
async function get_password(date, el) {
//password changes every day
const master_bytes = new TextEncoder().encode(`${document.getElementById("master-password").value}${date.getUTCFullYear()}-${date.getUTCMonth()}-${date.getUTCDate()}`);
@@ -32,6 +28,13 @@
}
document.getElementById(el).innerText = hash_hex.toLowerCase();
}
function get_passwords() {
get_password(new Date(), "computed");
get_password(new Date((new Date()).getTime() + 24 * 60 * 60 * 1000), "computed2");
}
function detect_enter(e) {
if (e.key === "Enter") get_passwords();
}
</script>
</body>
</html>