瀏覽代碼

fixed so animation starts as soon as one pushes the button and animation stops if login failed

Patrick O'Carroll 7 年之前
父節點
當前提交
050902a1e7
共有 1 個文件被更改,包括 16 次插入11 次删除
  1. 16 11
      public/app/core/controllers/login_ctrl.ts

+ 16 - 11
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() {