Make registering and logging in with a threepid work in the webclient.

This commit is contained in:
David Baker 2014-09-03 18:23:56 +01:00
parent d6ecbbdf0a
commit a25d1530ef
5 changed files with 113 additions and 27 deletions

View file

@ -84,13 +84,14 @@ angular.module('matrixService', [])
prefix: prefixPath,
// Register an user
register: function(user_name, password) {
register: function(user_name, password, threepidCreds) {
// The REST path spec
var path = "/register";
return doRequest("POST", path, undefined, {
user_id: user_name,
password: password
password: password,
threepidCreds: threepidCreds
});
},
@ -315,9 +316,9 @@ angular.module('matrixService', [])
return doBaseRequest(config.identityServer, "POST", path, {}, data, headers);
},
authEmail: function(clientSecret, tokenId, code) {
authEmail: function(clientSecret, sid, code) {
var path = "/_matrix/identity/api/v1/validate/email/submitToken";
var data = "token="+code+"&sid="+tokenId+"&clientSecret="+clientSecret;
var data = "token="+code+"&sid="+sid+"&clientSecret="+clientSecret;
var headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
return doBaseRequest(config.identityServer, "POST", path, {}, data, headers);
@ -330,6 +331,11 @@ angular.module('matrixService', [])
headers["Content-Type"] = "application/x-www-form-urlencoded";
return doBaseRequest(config.identityServer, "POST", path, {}, data, headers);
},
lookup3pid: function(medium, address) {
var path = "/_matrix/identity/api/v1/lookup?medium="+encodeURIComponent(medium)+"&address="+encodeURIComponent(address);
return doBaseRequest(config.identityServer, "GET", path, {}, undefined, {});
},
uploadContent: function(file) {
var path = "/_matrix/content";