Initial commit
This commit is contained in:
21
Plugins/CloudNetWebinterface/htdocs/login/script.js
Normal file
21
Plugins/CloudNetWebinterface/htdocs/login/script.js
Normal file
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user