// if at least one workstation exists, it must be used.
if (!args.workstation && $scope.workstations.length > 0) return;
+ if ($location.search().restrict_path) {
+ // Limit staff login access to this path plus any
+ // sub-paths. Attempts to navigate to another part
+ // of the application will result in a new login dialog.
+ egCore.hatch.cookiePath =
+ egCore.env.basePath + $location.search().restrict_path;
+ }
+
args.type = 'staff';
egCore.auth.login(args).then(
egCore.env.loadClasses.push('aous');
+ // Limit self-check staff logins to the selfcheck path.
+ egCore.startup.restrictLoginPath = 'circ/selfcheck';
+
return egCore.startup.go().then(function() {
// TODO load other startup data.
});
return oncall;
}
+ // Defaults to <base> path. Overrride to limit loginSessionItems to
+ // a sub-path of the /eg/staff application.
+ service.cookiePath = null;
+
// write a message to the Hatch port
service.sendToHatch = function(msg) {
var msg2 = {};
service.addLoginSessionKey(key);
if (jsonified === undefined )
jsonified = JSON.stringify(value);
- $cookies.put(key, jsonified);
+
+ var options = {secure : true}; // cookie options
+ if (service.cookiePath) {
+ console.debug('Using LoginSessionItem path ' + service.cookiePath);
+ options.path = service.cookiePath;
+ }
+
+ $cookies.put(key, jsonified, options);
}
// Set the value for the given key.
// change locations to the login page, using the current page
// as the 'route_to' destination on /login
- $window.location.href = $location
- .path('/login')
- .search({route_to :
- $window.location.pathname + $window.location.search})
- .absUrl();
+ // Compile the URL manually in lieu of using $location.path(..) /
+ // $location.search(...) to avoid intermediate route changes.
+ var newUrl =
+ egEnv.basePath + // /eg/staff/
+ 'login' +
+ '?route_to=' + encodeURIComponent(
+ $window.location.pathname + $window.location.search);
+
+ if (service.restrictLoginPath) {
+ newUrl += '&restrict_path=' +
+ encodeURIComponent(service.restrictLoginPath);
+ }
+
+ $window.location.href = newUrl;
return false;
}