From d869f82dc2e07bd85f815637cda40bbfaa844976 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Fri, 15 Aug 2014 14:10:33 -0400 Subject: [PATCH] Login dialog If the attempt to get the license ('/api/v1/config') or user info ('/api/v1/me') fails, force user back to the login page. Additionally, call Authorization.logout() to make sure any residual token or user info is cleared. Tweaked the login HTML so that ng-show on the login dialog header message will cause the message to show when the sessionExpired variable is null or undefined. --- awx/ui/static/js/controllers/Authentication.js | 17 ++++++++++++----- config/awx-munin.conf | 11 +++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/awx/ui/static/js/controllers/Authentication.js b/awx/ui/static/js/controllers/Authentication.js index b59908137e..d5c4486ae2 100644 --- a/awx/ui/static/js/controllers/Authentication.js +++ b/awx/ui/static/js/controllers/Authentication.js @@ -13,13 +13,20 @@ function Authenticate($log, $cookieStore, $compile, $window, $scope, $rootScope, $location, Authorization, ToggleClass, Alert, Wait, Timer, Empty) { - var setLoginFocus, lastPath, sessionExpired, + var setLoginFocus, lastPath, sessionExpired, loginAgain, e, html, scope = $rootScope.$new(); setLoginFocus = function () { $('#login-username').focus(); }; + loginAgain = function() { + Authorization.logout(); + setTimeout(function() { + window.location = '/#/logout'; // if we get here, force user back to re-login + }, 500); + }; + scope.sessionExpired = (Empty($rootScope.sessionExpired)) ? $cookieStore.get('sessionExpired') : $rootScope.sessionExpired; scope.login_username = ''; scope.login_password = ''; @@ -53,8 +60,8 @@ function Authenticate($log, $cookieStore, $compile, $window, $scope, $rootScope, "" + "\n" + "
\n" + - "
Welcome to Ansible Tower!  Please sign in.
\n" + - "
Your session timed out due to inactivity. Please sign in.
\n" + + "
Welcome to Ansible Tower!  Please sign in.
\n" + + "
Your session timed out due to inactivity. Please sign in.
\n" + "
\n" + "
\n" + "\n" + @@ -129,7 +136,7 @@ function Authenticate($log, $cookieStore, $compile, $window, $scope, $rootScope, }) .error(function () { Wait('stop'); - Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', setLoginFocus); + Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', loginAgain); }); }); @@ -146,7 +153,7 @@ function Authenticate($log, $cookieStore, $compile, $window, $scope, $rootScope, }) .error(function (data, status) { Wait('stop'); - Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus); + Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', loginAgain); }); }); diff --git a/config/awx-munin.conf b/config/awx-munin.conf index 90c479f77a..833a6f36bf 100644 --- a/config/awx-munin.conf +++ b/config/awx-munin.conf @@ -1,17 +1,12 @@ - -Alias /munin /var/cache/munin/www - +Alias /munin /var/www/html/munin/ + Order Allow,Deny Allow from all - Options FollowSymLinks AuthUserFile /var/lib/awx/.munin_htpasswd AuthName "Munin" AuthType Basic require valid-user - - ExpiresActive On - ExpiresDefault M310 - +ScriptAlias /munin-cgi/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph \ No newline at end of file