mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 12:57:40 -02:30
AC-435 Added 'working' spinner to login dialog
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Authorization, ToggleClass, Alert)
|
function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Authorization, ToggleClass, Alert, Wait)
|
||||||
{
|
{
|
||||||
var setLoginFocus = function() {
|
var setLoginFocus = function() {
|
||||||
$('#login-username').focus();
|
$('#login-username').focus();
|
||||||
@@ -60,12 +60,13 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
Alert('Error!', 'Please provide a username and password before attempting to login.', 'alert-danger', setLoginFocus);
|
Alert('Error!', 'Please provide a username and password before attempting to login.', 'alert-danger', setLoginFocus);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Wait('start');
|
||||||
Authorization.retrieveToken(username, password)
|
Authorization.retrieveToken(username, password)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
|
Wait('stop');
|
||||||
$('#login-modal').modal('hide');
|
$('#login-modal').modal('hide');
|
||||||
token = data.token;
|
token = data.token;
|
||||||
Authorization.setToken(data.token, data.expires);
|
Authorization.setToken(data.token, data.expires);
|
||||||
|
|
||||||
// Get all the profile/access info regarding the logged in user
|
// Get all the profile/access info regarding the logged in user
|
||||||
Authorization.getUser()
|
Authorization.getUser()
|
||||||
.success(function(data, status, headers, config) {
|
.success(function(data, status, headers, config) {
|
||||||
@@ -84,6 +85,7 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
|
Wait('stop');
|
||||||
if ( data.non_field_errors && data.non_field_errors.length == 0 ) {
|
if ( data.non_field_errors && data.non_field_errors.length == 0 ) {
|
||||||
// show field specific errors returned by the API
|
// show field specific errors returned by the API
|
||||||
for (var key in data) {
|
for (var key in data) {
|
||||||
@@ -108,5 +110,5 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Authenticate.$inject = ['$cookieStore', '$window', '$scope', '$rootScope', '$location', 'Authorization', 'ToggleClass', 'Alert'];
|
Authenticate.$inject = ['$cookieStore', '$window', '$scope', '$rootScope', '$location', 'Authorization', 'ToggleClass', 'Alert', 'Wait'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user