From 050902a1e7a1ef0f6c937ecc4a0eac99e3149924 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Thu, 23 Aug 2018 15:31:25 +0200 Subject: [PATCH] fixed so animation starts as soon as one pushes the button and animation stops if login failed --- public/app/core/controllers/login_ctrl.ts | 27 ++++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/public/app/core/controllers/login_ctrl.ts b/public/app/core/controllers/login_ctrl.ts index 606841cb19d..1834892a536 100644 --- a/public/app/core/controllers/login_ctrl.ts +++ b/public/app/core/controllers/login_ctrl.ts @@ -102,22 +102,27 @@ export class LoginCtrl { $scope.login = function() { delete $scope.loginError; + $scope.loggingIn = true; if (!$scope.loginForm.$valid) { return; } - backendSrv.post('/login', $scope.formModel).then(function(result) { - $scope.result = result; - - if ($scope.formModel.password !== 'admin' || $scope.ldapEnabled || $scope.authProxyEnabled) { - $scope.loggingIn = true; - $scope.toGrafana(); - return; - } else { - $scope.changeView(); - } - }); + backendSrv + .post('/login', $scope.formModel) + .then(function(result) { + $scope.result = result; + + if ($scope.formModel.password !== 'admin' || $scope.ldapEnabled || $scope.authProxyEnabled) { + $scope.toGrafana(); + return; + } else { + $scope.changeView(); + } + }) + .catch(() => { + $scope.loggingIn = false; + }); }; $scope.toGrafana = function() {