mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
fixed login modal straggling issues
This commit is contained in:
parent
77f9523984
commit
16340975fd
@ -80,7 +80,9 @@ export default
|
||||
$rootScope.lastPath = '/home';
|
||||
}
|
||||
x = Store('sessionTime');
|
||||
x[$rootScope.current_user.id].loggedIn = false;
|
||||
if ($rootScope.current_user) {
|
||||
x[$rootScope.current_user.id].loggedIn = false;
|
||||
}
|
||||
Store('sessionTime', x);
|
||||
|
||||
$rootScope.lastUser = $cookieStore.get('current_user').id;
|
||||
@ -98,7 +100,9 @@ export default
|
||||
$rootScope.token_expires = null;
|
||||
$rootScope.login_username = null;
|
||||
$rootScope.login_password = null;
|
||||
$rootScope.sessionTimer.clearTimers();
|
||||
if ($rootScope.sessionTimer) {
|
||||
$rootScope.sessionTimer.clearTimers();
|
||||
}
|
||||
},
|
||||
|
||||
getLicense: function () {
|
||||
@ -116,7 +120,7 @@ export default
|
||||
var license = data.license_info;
|
||||
license.analytics_status = data.analytics_status;
|
||||
license.version = data.version;
|
||||
license.ansible_version = data.ansible_version;
|
||||
license.ansible_version = data.ansible_version;
|
||||
license.tested = false;
|
||||
Store('license', license);
|
||||
$rootScope.features = Store('license').features;
|
||||
|
||||
@ -9,5 +9,11 @@ import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'signIn',
|
||||
route: '/login',
|
||||
templateUrl: templateUrl('login/loginBackDrop')
|
||||
templateUrl: templateUrl('login/loginBackDrop'),
|
||||
controller: ['$rootScope', 'Authorization', function($rootScope, Authorization) {
|
||||
if (Authorization.isUserLoggedIn()) {
|
||||
Authorization.logout();
|
||||
}
|
||||
$(".LoginModal-dialog").remove();
|
||||
}]
|
||||
};
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
/** @define LoginModal */
|
||||
.LoginModal-backDrop {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1041;
|
||||
opacity: 0;
|
||||
transition: 0.5s opacity;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.LoginModal-backDrop.is-loggedOut {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.LoginModal-dialog {
|
||||
margin: 30px auto;
|
||||
margin-top: 135px;
|
||||
@ -14,6 +30,8 @@
|
||||
border-radius: 4px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.5s;
|
||||
z-index: 1042;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.LoginModal-content.is-loggedOut {
|
||||
|
||||
@ -59,13 +59,7 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
|
||||
function ($log, $cookieStore, $compile, $window, $rootScope, $location, Authorization, ToggleClass, Alert, Wait,
|
||||
Timer, Empty, ClearScope, scope, pendoService) {
|
||||
|
||||
var setLoginFocus, lastPath, lastUser, sessionExpired, loginAgain;
|
||||
|
||||
setLoginFocus = function () {
|
||||
// Need to clear out any open dialog windows that might be open when this modal opens.
|
||||
ClearScope();
|
||||
$('#login-username').focus();
|
||||
};
|
||||
var lastPath, lastUser, sessionExpired, loginAgain;
|
||||
|
||||
loginAgain = function() {
|
||||
setTimeout(function() {
|
||||
@ -93,27 +87,17 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
|
||||
$log.debug('User session expired: ' + sessionExpired);
|
||||
$log.debug('Last URL: ' + lastPath());
|
||||
|
||||
// Hide any lingering modal dialogs
|
||||
$('.modal[aria-hidden=false]').each(function () {
|
||||
if ($(this).attr('id') !== 'login-modal') {
|
||||
$(this).modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
// Just in case, make sure the wait widget is not active
|
||||
// and scroll the window to the top
|
||||
Wait('stop');
|
||||
window.scrollTo(0,0);
|
||||
|
||||
// Set focus to username field
|
||||
$('#login-modal').on('shown.bs.modal', function () {
|
||||
setLoginFocus();
|
||||
});
|
||||
|
||||
$rootScope.loginConfig.promise.then(function () {
|
||||
scope.customLogo = ($AnsibleConfig.custom_logo) ? "custom_console_logo.png" : "tower_console_logo.png";
|
||||
if ($AnsibleConfig.custom_logo) {
|
||||
scope.customLogo = "custom_console_logo.png";
|
||||
scope.customLogoPresent = true;
|
||||
} else {
|
||||
scope.customLogo = "login_modal_logo.png";
|
||||
scope.customLogoPresent = false;
|
||||
}
|
||||
|
||||
scope.customLoginInfo = $AnsibleConfig.custom_login_info;
|
||||
scope.customLoginInfoPresent = ($AnsibleConfig.customLoginInfo) ? true : false;
|
||||
scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
|
||||
});
|
||||
|
||||
// Reset the login form
|
||||
@ -122,19 +106,6 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
|
||||
//$rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out.
|
||||
//$cookieStore.put('userLoggedIn', false); //gets set back to true by Authorization.setToken().
|
||||
|
||||
$('#login-password').bind('keypress', function (e) {
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code === 13) {
|
||||
$('#login-button').click();
|
||||
}
|
||||
});
|
||||
|
||||
scope.reset = function () {
|
||||
$('#login-form input').each(function () {
|
||||
$(this).val('');
|
||||
});
|
||||
};
|
||||
|
||||
if (scope.removeAuthorizationGetLicense) {
|
||||
scope.removeAuthorizationGetLicense();
|
||||
}
|
||||
|
||||
@ -7,14 +7,53 @@ import authenticationController from './loginModal.controller';
|
||||
|
||||
/* jshint unused: vars */
|
||||
export default
|
||||
[ 'templateUrl',
|
||||
function(templateUrl) {
|
||||
[ 'templateUrl',
|
||||
'ClearScope',
|
||||
'Wait',
|
||||
function(templateUrl, ClearScope, Wait) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
controller: authenticationController,
|
||||
templateUrl: templateUrl('login/loginModal/loginModal'),
|
||||
link: function(scope, element, attrs) {
|
||||
var setLoginFocus = function () {
|
||||
// Need to clear out any open dialog windows that might be open when this modal opens.
|
||||
ClearScope();
|
||||
$('#login-username').focus();
|
||||
};
|
||||
|
||||
setLoginFocus();
|
||||
|
||||
// Hide any lingering modal dialogs
|
||||
$('.modal[aria-hidden=false]').each(function () {
|
||||
if ($(this).attr('id') !== 'login-modal') {
|
||||
$(this).modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
// Just in case, make sure the wait widget is not active
|
||||
// and scroll the window to the top
|
||||
Wait('stop');
|
||||
window.scrollTo(0,0);
|
||||
|
||||
// Set focus to username field
|
||||
$('#login-modal').on('shown.bs.modal', function () {
|
||||
setLoginFocus();
|
||||
});
|
||||
|
||||
$('#login-password').bind('keypress', function (e) {
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code === 13) {
|
||||
$('#login-button').click();
|
||||
}
|
||||
});
|
||||
|
||||
scope.reset = function () {
|
||||
$('#login-form input').each(function () {
|
||||
$(this).val('');
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<div id="login-modal" class="LoginModal">
|
||||
<div class="LoginModal-backDrop"
|
||||
ng-class="{'is-loggedOut' : !$root.current_user.username}"></div>
|
||||
<div class="LoginModal-dialog">
|
||||
<div class="LoginModal-content"
|
||||
ng-class="{'is-loggedOut' : !$root.current_user.username}">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user