Bug fix: if no local storage, this.user = false
authorLoic Baron <loic.baron@lip6.fr>
Tue, 20 May 2014 08:51:38 +0000 (10:51 +0200)
committerLoic Baron <loic.baron@lip6.fr>
Tue, 20 May 2014 08:51:38 +0000 (10:51 +0200)
portal/static/js/myslice.js

index 2f86655..d9593af 100644 (file)
@@ -106,7 +106,11 @@ var myslice = {
        user: function() {
                if ($.isEmptyObject(this.user)) {
                        //this.login(function() { return this.user; });
-                       this.user = JSON.parse(localStorage.getItem('user'));
+            if(localStorage.getItem('user')!='undefined'){
+                           this.user = JSON.parse(localStorage.getItem('user'));
+            }else{
+                return false;
+            }
                }
                return this.user;
        },