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

View File

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