diff options
author | PeterTheOne <petertheone@gmail.com> | 2015-09-04 22:47:14 (GMT) |
---|---|---|
committer | PeterTheOne <petertheone@gmail.com> | 2015-09-04 22:47:14 (GMT) |
commit | 835154c209a03e76b2591527bcdd32e5a6e75110 (patch) | |
tree | 6b0e9de746b342ef3e08bf938ce4794a3ff5759a | |
parent | 3b4e8ab4a63d369261c0febd95d93c3f2a4fe662 (diff) |
show fullname
-rw-r--r-- | www/js/auth.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/www/js/auth.js b/www/js/auth.js index 8d0fc71..24c7a07 100644 --- a/www/js/auth.js +++ b/www/js/auth.js @@ -21,19 +21,22 @@ */ var auth_username; +var auth_fullname; var auth_token; function auth_loginSuccess(data) { if (data.status == 'OK') { auth_username = data.username; - sessionStorage.setItem("auth_username", auth_username); - + auth_fullname = data.fullname; auth_token = data.token; + + sessionStorage.setItem("auth_username", auth_username); + sessionStorage.setItem("auth_fullname", auth_fullname); sessionStorage.setItem("auth_token", auth_token); apps_select(apps_current); - $('#username-field').html(auth_username); + $('#username-field').html(auth_fullname + ' (' + auth_username + ')'); $('#loginbox').slideUp(); $('#mainwindow').fadeIn(); } else { @@ -76,11 +79,12 @@ function auth_logout() { function auth_init() { auth_username = sessionStorage.getItem("auth_username"); + auth_fullname = sessionStorage.getItem("auth_fullname"); auth_token = sessionStorage.getItem("auth_token"); - if(auth_token && auth_username) { + if(auth_token && auth_username && auth_fullname) { $("#loginbox").hide(); - $('#username-field').html(auth_username); + $('#username-field').html(auth_fullname + ' (' + auth_username + ')'); } else { $("#mainwindow").hide(); } @@ -92,6 +96,9 @@ function auth_cleanup() { delete auth_username; $("#username").val('').focus(); + sessionStorage.removeItem("auth_fullname"); + delete auth_fullname; + sessionStorage.removeItem("auth_token"); delete auth_token; $("#password").val(''); |