@ -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." ;
}
}
) ;
} ;