Redirect the user to the link they clicked on after authentication

This commit is contained in:
Michael Abashian 2017-06-08 18:40:12 -04:00
parent d3c9b57133
commit fc312398cd
3 changed files with 5 additions and 2 deletions

View File

@ -364,6 +364,8 @@ var tower = angular.module('Tower', [
if (!Authorization.getToken() || !Authorization.isUserLoggedIn()) {
// User not authenticated, redirect to login page
$rootScope.lastPath = $location.path();
$cookies.put('lastPath', $location.path());
$location.path('/login');
} else {
var lastUser = $cookies.getObject('current_user'),

View File

@ -103,7 +103,7 @@ export default
Store('sessionTime', x);
if ($cookies.getObject('current_user')) {
$rootScope.lastUser = $cookies.getObject('current_user').id;
$cookies.put( 'lastUser', $cookies.getObject('current_user').id);
}
ConfigService.delete();
SocketService.disconnect();

View File

@ -80,7 +80,8 @@ export default ['$log', '$cookies', '$compile', '$rootScope',
};
lastUser = function(){
if(!Empty($rootScope.lastUser) && $rootScope.lastUser === $rootScope.current_user.id){
let lastUser = $cookies.get('lastUser');
if(!Empty(lastUser) && parseInt(lastUser) === $rootScope.current_user.id){
return true;
}
else {