diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-14 16:03:04 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-14 16:03:04 +0100 |
commit | fb93e14e530d6dfddf22d77eb42be5758f2d50f5 (patch) | |
tree | a47f61c4000586458d65e72b1d2521b206d5ce53 /webclient/login/login-controller.js | |
parent | Finish up room controller too. May have missed one or two, but testing didn't... (diff) | |
download | synapse-fb93e14e530d6dfddf22d77eb42be5758f2d50f5.tar.xz |
Be more helpful when failing to register/login, stating why (communication error, user in user, wrong credentials, etc). Make the HS send M_USER_IN_USE.
Diffstat (limited to '')
-rw-r--r-- | webclient/login/login-controller.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js index 015868b0b9..53756be9ea 100644 --- a/webclient/login/login-controller.js +++ b/webclient/login/login-controller.js @@ -55,8 +55,15 @@ angular.module('LoginController', ['matrixService']) // Go to the user's rooms list page $location.path("rooms"); }, - function(reason) { - $scope.feedback = "Failure: " + reason; + function(error) { + if (error.data) { + if (error.data.errcode === "M_USER_IN_USE") { + $scope.feedback = "Username already taken."; + } + } + else if (error.status === 0) { + $scope.feedback = "Unable to talk to the server."; + } }); }; @@ -83,8 +90,13 @@ angular.module('LoginController', ['matrixService']) } }, function(error) { - if (error.data.errcode === "M_FORBIDDEN") { - $scope.login_error_msg = "Incorrect username or password."; + if (error.data) { + if (error.data.errcode === "M_FORBIDDEN") { + $scope.login_error_msg = "Incorrect username or password."; + } + } + else if (error.status === 0) { + $scope.login_error_msg = "Unable to talk to the server."; } } ); |