$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
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) {
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();
}
- );
- }
+ }
+ );
}
]
}