mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 13:54:58 -04:00
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.
This commit is contained in:
parent
76005c44f7
commit
db3e1d73c6
4 changed files with 16 additions and 30 deletions
|
@ -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.";
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue