usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [1/2] incubator-usergrid git commit: [USERGRID-561] Adding error handling for network errors on login
Date Fri, 17 Apr 2015 20:13:51 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 488fa9369 -> 5a60f1f64


[USERGRID-561] Adding error handling for network errors on login


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5355864b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5355864b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5355864b

Branch: refs/heads/two-dot-o-dev
Commit: 5355864b7ce2a23767258dcf0806c8480ce6890b
Parents: f67c0eb
Author: ryan bridges <ryanb@apache.org>
Authored: Thu Apr 16 13:02:08 2015 -0400
Committer: ryan bridges <ryanb@apache.org>
Committed: Thu Apr 16 13:04:58 2015 -0400

----------------------------------------------------------------------
 portal/js/login/login-controller.js | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5355864b/portal/js/login/login-controller.js
----------------------------------------------------------------------
diff --git a/portal/js/login/login-controller.js b/portal/js/login/login-controller.js
index 0eeac7a..a20355e 100755
--- a/portal/js/login/login-controller.js
+++ b/portal/js/login/login-controller.js
@@ -25,7 +25,7 @@ AppServices.Controllers.controller('LoginCtrl', ['ug', '$scope', '$rootScope',
'
   $scope.activation = {};
   $scope.requiresDeveloperKey=$scope.options.client.requiresDeveloperKey||false;
   if(!$scope.requiresDeveloperKey && $scope.options.client.apiKey){
-    ug.setClientProperty('developerkey', $scope.options.client.apiKey);    
+    ug.setClientProperty('developerkey', $scope.options.client.apiKey);
   }
   $rootScope.gotoForgotPasswordPage = function(){
     $location.path("/forgot-password");
@@ -48,11 +48,20 @@ AppServices.Controllers.controller('LoginCtrl', ['ug', '$scope', '$rootScope',
'
     ug.orgLogin(username, password);
 
   }
-  $scope.$on('loginFailed',function(){
+  $scope.$on('loginFailed',function(event, err, data){
     $scope.loading = false;
     //let the user know the login was not valid
     ug.setClientProperty('developerkey', null);
-    $scope.loginMessage = "Error: the username / password combination was not valid";
+    var errorMessage="An error occurred while attempting to authenticate";
+    if (data instanceof XMLHttpRequestProgressEvent){
+      $scope.loginMessage = "Error: An error occurred while connecting to "+Usergrid.overrideUrl;
+    }else if(status == 400){
+      $scope.loginMessage = "Error: the username / password combination was not valid";
+    } else {
+      $scope.loginMessage = "Error: "+((data.error_description.length>1)?data.error_description:errorMessage);
+    }
+      console.log("LOGIN RESPONSE", err, data);
+
     $scope.applyScope();
   });
 


Mime
View raw message