login / authtoken repairs
authorBill Erickson <berick@esilibrary.com>
Wed, 25 Jun 2014 20:52:20 +0000 (16:52 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 25 Jun 2014 20:52:20 +0000 (16:52 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/web/js/ui/default/staff/app.js
Open-ILS/web/js/ui/default/staff/services/navbar.js

index 1c73cf3..5c155a9 100644 (file)
@@ -21,13 +21,7 @@ function($routeProvider , $locationProvider) {
     $routeProvider.when('/login', {
         templateUrl: './t_login',
         controller: 'LoginCtrl',
-        resolve : {delay : ['egCore', function(egCore) {
-            // hack for now to kill the base ses cookie where sub-path
-            // apps were unable to remove it.  See note at the top of 
-            // services/auth.js about angular cookies and paths.
-            egCore.auth.logout();
-            return egCore.startup.go();
-        }]}
+        resolve : resolver
     });
 
     // default page 
@@ -50,6 +44,9 @@ function($routeProvider , $locationProvider) {
     function($scope , $location , $window , egCore) {
         $scope.focusMe = true;
 
+        // if the user is already logged in, jump to splash page
+        if (egCore.auth.user()) $location.path('/');
+
         egCore.hatch.getItem('eg.workstation.all')
         .then(function(all) {
             if (all && all.length) {
index ed017af..8806d65 100644 (file)
@@ -64,17 +64,14 @@ angular.module('egCoreMod')
                     return true;
                 };
 
-                // display the username and workstation after startup completes
-                if ($location.path() != '/login') {
-                    // avoiding rending user info on the login page
-
-                    egCore.startup.go().then(
-                        function() {
+                egCore.startup.go().then(
+                    function() {
+                        if (egCore.auth.user()) {
                             $scope.username = egCore.auth.user().usrname();
                             $scope.workstation = egCore.auth.workstation();
                         }
-                    );
-                }
+                    }
+                );
             }
         ]
     }