|
@@ -1,3 +1,12 @@
|
|
|
+async function checkLogin() {
|
|
|
+ let resp = await fetch('../whoami')
|
|
|
+ if (resp.ok) {
|
|
|
+ console.log("Already logged in, let's change password instead")
|
|
|
+ document.location.href = 'change.html'
|
|
|
+ }
|
|
|
+ data = await resp.json()
|
|
|
+}
|
|
|
+
|
|
|
async function onSubmit(evt) {
|
|
|
evt.preventDefault()
|
|
|
|
|
@@ -14,6 +23,7 @@ async function onSubmit(evt) {
|
|
|
}
|
|
|
|
|
|
function initLogin() {
|
|
|
+ checkLogin()
|
|
|
document.getElementById("login-form").addEventListener('submit', onSubmit, false)
|
|
|
}
|
|
|
document.addEventListener('DOMContentLoaded', initLogin)
|