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