diff options
Diffstat (limited to '')
-rw-r--r-- | js/login.js | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/js/login.js b/js/login.js index cc20f8b..4633306 100644 --- a/js/login.js +++ b/js/login.js @@ -21,25 +21,25 @@ function setupEventListeners() { // Handle login button click function login() { - let username = $("#username").val(); - let password = $("#password").val(); - var gsecInstance = new gsec(); - gsecInstance.login(username, password).then( (value) => { - if (typeof value == "string") { - let promises_to_run = [ - localforage.setItem("logged_in", true), - localforage.setItem("username", username), - localforage.setItem("password", password) - ]; - Promise.all(promises_to_run).then(function () { - window.location.replace("/pages/timetable.html"); - }); - } else { - UIAlert("loginFailed"); - $("#password").val(""); - } - }).catch((err) => { - gsecErrorHandlerUI(err); - $("#password").val(""); - }); + let username = $("#username").val(); + let password = $("#password").val(); + var gsecInstance = new gsec(); + gsecInstance.login(username, password).then( (value) => { + if (typeof value == "string") { + let promises_to_run = [ + localforage.setItem("logged_in", true), + localforage.setItem("username", username), + localforage.setItem("password", password) + ]; + Promise.all(promises_to_run).then(function () { + window.location.replace("/pages/timetable.html"); + }); + } else { + UIAlert("loginFailed"); + $("#password").val(""); + } + }).catch((err) => { + gsecErrorHandlerUI(err); + $("#password").val(""); + }); } |