Remove open modals when logging in

If the session times out, and the user attempts to open a modal dialog, then it must be closed due to the fact that bootstrap modals do not work with more than one modal open. The login modal is a bootstrap modal so all other modals need to be closed when it is shown.
This commit is contained in:
Jared Tabor 2014-12-05 14:29:42 -05:00
parent 9c80dba4a2
commit 1ffca45c4a
3 changed files with 9 additions and 3 deletions

View File

@ -437,7 +437,7 @@ angular.module('Tower', [
}])
.run(['$compile', '$cookieStore', '$rootScope', '$log', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer', 'ClearScope', 'HideStream', 'Socket',
'LoadConfig', 'Store', 'ShowSocketHelp', 'LicenseViewer', 'AboutAnsibleHelp', 'ConfigureTower', 'CreateCustomInventory' ,
'LoadConfig', 'Store', 'ShowSocketHelp', 'LicenseViewer', 'AboutAnsibleHelp', 'ConfigureTower', 'CreateCustomInventory',
function ($compile, $cookieStore, $rootScope, $log, CheckLicense, $location, Authorization, LoadBasePaths, Timer, ClearScope, HideStream, Socket,
LoadConfig, Store, ShowSocketHelp, LicenseViewer, AboutAnsibleHelp, ConfigureTower, CreateCustomInventory) {

View File

@ -60,12 +60,14 @@
'use strict';
function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $location, Authorization, ToggleClass, Alert, Wait,
Timer, Empty) {
Timer, Empty, ClearScope) {
var setLoginFocus, lastPath, sessionExpired, loginAgain,
e, html, scope = $rootScope.$new();
setLoginFocus = function () {
// Need to clear out any open dialog windows that might be open when this modal opens.
ClearScope();
$('#login-username').focus();
};
@ -249,5 +251,5 @@ function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $locati
}
Authenticate.$inject = ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$location', 'Authorization', 'ToggleClass', 'Alert', 'Wait',
'Timer', 'Empty'
'Timer', 'Empty', 'ClearScope'
];

View File

@ -40,6 +40,10 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
$(this).remove();
});
$('.ui-dialog-content').each(function(){
$(this).dialog('close');
});
try {
$('#help-modal').dialog('close');
} catch (e) {