From 835154c209a03e76b2591527bcdd32e5a6e75110 Mon Sep 17 00:00:00 2001
From: PeterTheOne <petertheone@gmail.com>
Date: Sat, 5 Sep 2015 00:47:14 +0200
Subject: show fullname


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('');
-- 
cgit v0.10.2