diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-14 15:36:40 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-14 15:36:40 +0100 |
commit | db3e1d73c6a81bda3b2624596ea9b3f113242d38 (patch) | |
tree | 7c91027f8ffdee353ef4765107f89b07864325ca /webclient/login | |
parent | Added an access token interceptor to check unknown tokens. (diff) | |
download | synapse-db3e1d73c6a81bda3b2624596ea9b3f113242d38.tar.xz |
Move the unknown token broadcast to the interceptor. Return the $http promise and not a wrapped one via $q. Everything now needs a level deeper nesting. Fixed registration and login.
Diffstat (limited to 'webclient/login')
-rw-r--r-- | webclient/login/login-controller.js | 14 | ||||
-rw-r--r-- | webclient/login/login.html | 1 |
2 files changed, 10 insertions, 5 deletions
diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js index fa91bf4253..c519f7698c 100644 --- a/webclient/login/login-controller.js +++ b/webclient/login/login-controller.js @@ -39,14 +39,13 @@ angular.module('LoginController', ['matrixService']) } matrixService.register($scope.account.desired_user_name, $scope.account.pwd1).then( - function(data) { + function(response) { $scope.feedback = "Success"; - // Update the current config var config = matrixService.config(); angular.extend(config, { - access_token: data.access_token, - user_id: data.user_id + access_token: response.data.access_token, + user_id: response.data.user_id }); matrixService.setConfig(config); @@ -74,7 +73,7 @@ angular.module('LoginController', ['matrixService']) matrixService.setConfig({ homeserver: $scope.account.homeserver, user_id: $scope.account.user_id, - access_token: response.access_token + access_token: response.data.access_token }); matrixService.saveConfig(); $location.path("rooms"); @@ -82,6 +81,11 @@ angular.module('LoginController', ['matrixService']) else { $scope.feedback = "Failed to login: " + JSON.stringify(response); } + }, + function(error) { + if (error.data.errcode === "M_FORBIDDEN") { + $scope.login_error_msg = "Incorrect username or password."; + } } ); }; diff --git a/webclient/login/login.html b/webclient/login/login.html index 508ff5e4bf..f02dde89a6 100644 --- a/webclient/login/login.html +++ b/webclient/login/login.html @@ -22,6 +22,7 @@ <h3>Got an account?</h3> <form novalidate> <!-- Login with an registered user --> + <div>{{ login_error_msg }} </div> <div> <input id="user_id" size="70" type="text" auto-focus ng-model="account.user_id" placeholder="User ID (ex:@bob:localhost)"/> <br /> |