Merge pull request #259 from trendal/main

login page enter key action
This commit is contained in:
Herbert "TheBracket 2023-02-08 06:40:21 -08:00 committed by GitHub
commit 2ae80f9fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 19 deletions

View File

@ -41,28 +41,39 @@
</div>
</div>
<footer>Copyright (c) 2022, LibreQoE LLC</footer>
<footer>
<a href="https://libreqos.io/credits/">Copyright (c) 2022, LibreQoE LLC</a>
</footer>
<script>
function try_login() {
let newUser = {
username: $("#username").val(),
password: $("#password").val(),
};
$.ajax({
type: "POST",
url: "/api/login",
data: JSON.stringify(newUser),
success: (data) => {
if (data == "ERROR") {
alert("Invalid login")
} else {
window.location.href = "/";
}
}
})
}
function start() {
$("#btnLogin").on('click', (data) => {
let newUser = {
username: $("#username").val(),
password: $("#password").val(),
};
$.ajax({
type: "POST",
url: "/api/login",
data: JSON.stringify(newUser),
success: (data) => {
if (data == "ERROR") {
alert("Invalid login")
} else {
window.location.href = "/";
}
}
})
});
$("#btnLogin").on('click', try_login)
$(document).on('keydown', (e) => {
if (e.keyCode === 13) {
try_login()
}
})
}
$(document).ready(start);

View File

@ -16,3 +16,4 @@
.mbot8 { margin-bottom: 8px; }
.row220 { height: 220px; }
.redact { font-display: unset; }
footer > a { color: white; }