mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
Merge pull request #6527 from mabashian/6474-login-redirect
Login redirect to clicked link
This commit is contained in:
@@ -364,6 +364,9 @@ var tower = angular.module('Tower', [
|
|||||||
|
|
||||||
if (!Authorization.getToken() || !Authorization.isUserLoggedIn()) {
|
if (!Authorization.getToken() || !Authorization.isUserLoggedIn()) {
|
||||||
// User not authenticated, redirect to login page
|
// User not authenticated, redirect to login page
|
||||||
|
if (!/^\/(login|logout)/.test($location.path())) {
|
||||||
|
$rootScope.preAuthUrl = $location.path();
|
||||||
|
}
|
||||||
$location.path('/login');
|
$location.path('/login');
|
||||||
} else {
|
} else {
|
||||||
var lastUser = $cookies.getObject('current_user'),
|
var lastUser = $cookies.getObject('current_user'),
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default ['$log', '$cookies', '$compile', '$rootScope',
|
|||||||
Authorization, Alert, Wait, Timer, Empty,
|
Authorization, Alert, Wait, Timer, Empty,
|
||||||
scope, pendoService, ConfigService, CheckLicense, FeaturesService,
|
scope, pendoService, ConfigService, CheckLicense, FeaturesService,
|
||||||
SocketService) {
|
SocketService) {
|
||||||
var lastPath, lastUser, sessionExpired, loginAgain;
|
var lastPath, lastUser, sessionExpired, loginAgain, preAuthUrl;
|
||||||
|
|
||||||
loginAgain = function() {
|
loginAgain = function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@@ -88,6 +88,8 @@ export default ['$log', '$cookies', '$compile', '$rootScope',
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
preAuthUrl = $rootScope.preAuthUrl;
|
||||||
|
|
||||||
$log.debug('User session expired: ' + sessionExpired);
|
$log.debug('User session expired: ' + sessionExpired);
|
||||||
$log.debug('Last URL: ' + lastPath());
|
$log.debug('Last URL: ' + lastPath());
|
||||||
|
|
||||||
@@ -112,11 +114,17 @@ export default ['$log', '$cookies', '$compile', '$rootScope',
|
|||||||
pendoService.issuePendoIdentity();
|
pendoService.issuePendoIdentity();
|
||||||
FeaturesService.get();
|
FeaturesService.get();
|
||||||
Wait("stop");
|
Wait("stop");
|
||||||
if (lastPath() && lastUser()) {
|
if(!Empty(preAuthUrl)){
|
||||||
// Go back to most recent navigation path
|
$location.path(preAuthUrl);
|
||||||
$location.path(lastPath());
|
delete $rootScope.preAuthUrl;
|
||||||
} else {
|
}
|
||||||
$location.url('/home');
|
else {
|
||||||
|
if (lastPath() && lastUser()) {
|
||||||
|
// Go back to most recent navigation path
|
||||||
|
$location.path(lastPath());
|
||||||
|
} else {
|
||||||
|
$location.url('/home');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function () {
|
.catch(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user