Archived
Private
Public Access
1
0
This repository has been archived on 2026-02-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ProjectBackup/Plugins/CloudNetWebinterface/htdocs/login/script.js
2022-09-04 12:45:01 +02:00

21 lines
721 B
JavaScript

const submit = document.getElementById("submit");
submit.onclick = async function() {
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const response = await sendGetRequest(hostname + "/api/users/login?username=" + username + "&password=" + password);
if (response !== "false") {
sessionStorage.setItem("sessionKey", response);
sessionKey = response;
location.href = hostname;
}else {
showSnackbar();
}
}
function showSnackbar() {
document.getElementById('snackbar')?.classList.add('show');
setTimeout(() => {document.getElementById('snackbar')?.classList.remove('show');}, 5000);
}