diff --git a/public/js/services/AuthSvc.js b/public/js/services/AuthSvc.js index ab850dd..7b33a5d 100644 --- a/public/js/services/AuthSvc.js +++ b/public/js/services/AuthSvc.js @@ -37,10 +37,12 @@ angular.module('AuthSvc', []).service('AuthService', ['$http', '$window', functi data: user }).then(function(res) { saveToken(res.data.token); + $window.location.href = '/home'; }) }; this.logout = function() { $window.localStorage.removeItem('shimapan-token'); + $window.location.href = '/'; }; this.isLoggedIn = function() { var payload = decodeToken(getToken()); @@ -61,6 +63,7 @@ angular.module('AuthSvc', []).service('AuthService', ['$http', '$window', functi data: user }).then(function(res) { saveToken(res.data.token); + $window.location.href = '/home'; }); }; diff --git a/public/js/shimapan-panel/controllers/NavCtrl.js b/public/js/shimapan-panel/controllers/NavCtrl.js index d643558..29e7f51 100644 --- a/public/js/shimapan-panel/controllers/NavCtrl.js +++ b/public/js/shimapan-panel/controllers/NavCtrl.js @@ -4,11 +4,6 @@ angular.module('NavCtrl', ['AuthSvc']).controller('NavController', ['$scope', '$ $scope.currentScope = AuthService.currentScope(); $scope.logout = AuthService.logout; - $scope.goLogout = function() { - $scope.logout(); - $window.location.href = '/'; - }; - $scope.hasPermission = function(permission) { if (!$scope.currentScope) return false; return $scope.currentScope.indexOf(permission) !== -1; diff --git a/public/js/shimapan/components/LoginComp.js b/public/js/shimapan/components/LoginComp.js index 23f7abe..28f5c84 100644 --- a/public/js/shimapan/components/LoginComp.js +++ b/public/js/shimapan/components/LoginComp.js @@ -5,9 +5,7 @@ angular.module('LoginComp', ['AuthSvc']).component('loginComponent', { AuthService.login({ username: $scope.username, password: $scope.password - }).then(function () { - alert('Logged In'); }); - } + }; }] }); \ No newline at end of file diff --git a/public/js/shimapan/components/RegisterComp.js b/public/js/shimapan/components/RegisterComp.js index 4f0176a..1c63278 100644 --- a/public/js/shimapan/components/RegisterComp.js +++ b/public/js/shimapan/components/RegisterComp.js @@ -6,8 +6,6 @@ angular.module('RegisterComp', ['AuthSvc']).component('registerComponent', { username: $scope.username, password: $scope.password, invite: $scope.invite - }).then(function () { - alert('Registered'); }); }; }] diff --git a/public/views/panel.html b/public/views/panel.html index 2e4dbe3..46c1d0c 100644 --- a/public/views/panel.html +++ b/public/views/panel.html @@ -27,7 +27,7 @@