mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 15:58:45 -03:30
fixed login modal straggling issues
This commit is contained in:
@@ -80,7 +80,9 @@ export default
|
|||||||
$rootScope.lastPath = '/home';
|
$rootScope.lastPath = '/home';
|
||||||
}
|
}
|
||||||
x = Store('sessionTime');
|
x = Store('sessionTime');
|
||||||
x[$rootScope.current_user.id].loggedIn = false;
|
if ($rootScope.current_user) {
|
||||||
|
x[$rootScope.current_user.id].loggedIn = false;
|
||||||
|
}
|
||||||
Store('sessionTime', x);
|
Store('sessionTime', x);
|
||||||
|
|
||||||
$rootScope.lastUser = $cookieStore.get('current_user').id;
|
$rootScope.lastUser = $cookieStore.get('current_user').id;
|
||||||
@@ -98,7 +100,9 @@ export default
|
|||||||
$rootScope.token_expires = null;
|
$rootScope.token_expires = null;
|
||||||
$rootScope.login_username = null;
|
$rootScope.login_username = null;
|
||||||
$rootScope.login_password = null;
|
$rootScope.login_password = null;
|
||||||
$rootScope.sessionTimer.clearTimers();
|
if ($rootScope.sessionTimer) {
|
||||||
|
$rootScope.sessionTimer.clearTimers();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getLicense: function () {
|
getLicense: function () {
|
||||||
@@ -116,7 +120,7 @@ export default
|
|||||||
var license = data.license_info;
|
var license = data.license_info;
|
||||||
license.analytics_status = data.analytics_status;
|
license.analytics_status = data.analytics_status;
|
||||||
license.version = data.version;
|
license.version = data.version;
|
||||||
license.ansible_version = data.ansible_version;
|
license.ansible_version = data.ansible_version;
|
||||||
license.tested = false;
|
license.tested = false;
|
||||||
Store('license', license);
|
Store('license', license);
|
||||||
$rootScope.features = Store('license').features;
|
$rootScope.features = Store('license').features;
|
||||||
|
|||||||
@@ -9,5 +9,11 @@ import {templateUrl} from '../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'signIn',
|
name: 'signIn',
|
||||||
route: '/login',
|
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 */
|
/** @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 {
|
.LoginModal-dialog {
|
||||||
margin: 30px auto;
|
margin: 30px auto;
|
||||||
margin-top: 135px;
|
margin-top: 135px;
|
||||||
@@ -14,6 +30,8 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.5s;
|
transition: opacity 0.5s;
|
||||||
|
z-index: 1042;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.LoginModal-content.is-loggedOut {
|
.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,
|
function ($log, $cookieStore, $compile, $window, $rootScope, $location, Authorization, ToggleClass, Alert, Wait,
|
||||||
Timer, Empty, ClearScope, scope, pendoService) {
|
Timer, Empty, ClearScope, scope, pendoService) {
|
||||||
|
|
||||||
var setLoginFocus, lastPath, lastUser, sessionExpired, loginAgain;
|
var 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();
|
|
||||||
};
|
|
||||||
|
|
||||||
loginAgain = function() {
|
loginAgain = function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@@ -93,27 +87,17 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
|
|||||||
$log.debug('User session expired: ' + sessionExpired);
|
$log.debug('User session expired: ' + sessionExpired);
|
||||||
$log.debug('Last URL: ' + lastPath());
|
$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 () {
|
$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.customLoginInfo = $AnsibleConfig.custom_login_info;
|
||||||
scope.customLoginInfoPresent = ($AnsibleConfig.customLoginInfo) ? true : false;
|
scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset the login form
|
// 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.
|
//$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().
|
//$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) {
|
if (scope.removeAuthorizationGetLicense) {
|
||||||
scope.removeAuthorizationGetLicense();
|
scope.removeAuthorizationGetLicense();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,53 @@ import authenticationController from './loginModal.controller';
|
|||||||
|
|
||||||
/* jshint unused: vars */
|
/* jshint unused: vars */
|
||||||
export default
|
export default
|
||||||
[ 'templateUrl',
|
[ 'templateUrl',
|
||||||
function(templateUrl) {
|
'ClearScope',
|
||||||
|
'Wait',
|
||||||
|
function(templateUrl, ClearScope, Wait) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: true,
|
scope: true,
|
||||||
controller: authenticationController,
|
controller: authenticationController,
|
||||||
templateUrl: templateUrl('login/loginModal/loginModal'),
|
templateUrl: templateUrl('login/loginModal/loginModal'),
|
||||||
link: function(scope, element, attrs) {
|
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 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-dialog">
|
||||||
<div class="LoginModal-content"
|
<div class="LoginModal-content"
|
||||||
ng-class="{'is-loggedOut' : !$root.current_user.username}">
|
ng-class="{'is-loggedOut' : !$root.current_user.username}">
|
||||||
|
|||||||
Reference in New Issue
Block a user