1
0
Fork 0
mirror of https://github.com/shouptech/tempgopher.git synced 2026-02-03 16:49:42 +00:00
tempgopher/html/js/login.js
2018-10-13 19:06:34 -06:00

17 lines
624 B
JavaScript

// Retrieve username and password from fields, store a token, and redirect to main app
function processLogin() {
var username = $("#loginName").val();
var password = $("#loginPassword").val();
window.localStorage.setItem("authtoken", btoa(username + ":" + password));
window.location.replace(jsconfig.baseurl + "/app/");
};
function addClickToLogin() {
$("#loginButton").click(processLogin);
};
// If the login page is displayed, we need to remvoe any existing auth tokens
window.localStorage.removeItem("authtoken");
// Set the click function for the login button
$(document).ready(addClickToLogin);