$(document).ready(function() { // Login $("#username").keypress(function(e) { if(e.which == 13) $("#password").focus(); }); $("#password").keypress(function(e) { if(e.which == 13) $("#btnLogin").click(); }); $("#btnLogin").click(function() { const username = $("#username").val(); const password = $("#password").val(); const errorDiv = $("#loginError"); const createdDiv = $("#accountCreated"); const stayLoggedIn = $("#stayLoggedIn").is(":checked"); const btn = $(this); errorDiv.hide(); btn.prop("disabled", true); btn.html("Logging in… "); jsCore.apiCall("/user/login", {"username": username, "password": password, "stayLoggedIn": stayLoggedIn }, function(data) { window.location.reload(); }, function(err) { btn.html("Login"); btn.prop("disabled", false); $("#password").val(""); createdDiv.hide(); errorDiv.html(err); errorDiv.show(); }); }); $("#userTableRefresh").click(function() { let tbody = $("#userTable > tbody"); let page = parseInt($("#userPageNavigation li.active > a").text().trim()); tbody.find("tr").remove(); tbody.append("