Manage user global variable
Benjamin Renard

Benjamin Renard commited on 2014-01-12 19:03:12
Showing 1 changed files, with 2 additions and 3 deletions.

... ...
@@ -407,9 +407,7 @@ on_valid_login_modal=function(e) {
407 407
  * Sync
408 408
  ********************/
409 409
 on_click_sync_btn=function(e) {
410
-  if (jQuery.type(localStorage.user)!="undefined") {
411
-    user=JSON.parse(localStorage.user);
412
-    localStorage.oldgroups=groups.export();
410
+  if (user) {
413 411
     sync_server.sync(user.server, user.email, user.password, groups.export(),
414 412
       function(data) {
415 413
         console.log(data);
... ...
@@ -455,6 +453,7 @@ logged_menu=function() {
455 453
 }
456 454
 
457 455
 logged_out_menu=function() {
456
+  user=false;
458 457
   $('#user-name').html('Connexion');
459 458
   $('#user-menu li').remove();
460 459
   menu=$('#user-menu');
461 460