feat(oauth): spinner on code evaluation after sucessfull oauth

pull/2749/head
baron_l 2019-02-07 15:07:10 +01:00
parent 508352f4ea
commit 4d8133f696
2 changed files with 14 additions and 2 deletions

View File

@ -9,7 +9,7 @@
</div> </div>
<!-- !login box logo --> <!-- !login box logo -->
<!-- login panel --> <!-- login panel -->
<div class="panel panel-default"> <div class="panel panel-default" ng-show="!state.isInOAuthProcess">
<div class="panel-body"> <div class="panel-body">
<!-- login form --> <!-- login form -->
<form class="simple-box-form form-horizontal"> <form class="simple-box-form form-horizontal">
@ -49,6 +49,13 @@
</div> </div>
</div> </div>
<!-- !login panel --> <!-- !login panel -->
<div class="panel panel-default" ng-show="state.isInOAuthProcess">
<div class="panel-body">
<div class="form-group">
Connecting with OAuth <span class="pull-right" button-spinner="true"></span>
</div>
</div>
</div>
</div> </div>
</div> </div>
<!-- !login box --> <!-- !login box -->

View File

@ -8,7 +8,8 @@ angular.module('portainer.app').controller('AuthenticationController', ['$q', '$
}; };
$scope.state = { $scope.state = {
AuthenticationError: '' AuthenticationError: '',
isInOAuthProcess: true
}; };
$scope.authenticateUser = function() { $scope.authenticateUser = function() {
@ -89,6 +90,7 @@ angular.module('portainer.app').controller('AuthenticationController', ['$q', '$
if ($stateParams.logout || $stateParams.error) { if ($stateParams.logout || $stateParams.error) {
Authentication.logout(); Authentication.logout();
$scope.state.AuthenticationError = $stateParams.error; $scope.state.AuthenticationError = $stateParams.error;
$scope.state.isInOAuthProcess = false;
return; return;
} }
@ -106,6 +108,8 @@ angular.module('portainer.app').controller('AuthenticationController', ['$q', '$
var code = urlHelper.getParameter('code'); var code = urlHelper.getParameter('code');
if (code) { if (code) {
oAuthLogin(code); oAuthLogin(code);
} else {
$scope.state.isInOAuthProcess = false;
} }
} }
@ -117,6 +121,7 @@ angular.module('portainer.app').controller('AuthenticationController', ['$q', '$
}) })
.catch(function error() { .catch(function error() {
$scope.state.AuthenticationError = 'Failed to authenticate with OAuth2 Provider'; $scope.state.AuthenticationError = 'Failed to authenticate with OAuth2 Provider';
$scope.state.isInOAuthProcess = false;
}); });
} }