1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-18 05:42:00 +03:00

Support registration & next_links

This commit is contained in:
David Baker
2015-07-15 19:25:08 +01:00
parent ae7f9ab871
commit a89de9754f

View File

@@ -935,14 +935,17 @@ MatrixClient.prototype.login = function(loginType, data, callback) {
MatrixClient.prototype.register = function(username, password,
session_id, auth, callback) {
if (auth === undefined) { auth = {}; }
auth.session = session_id;
if (session_id) auth.session = session_id;
var params = {
auth: auth
};
if (username !== undefined) params.username = username;
if (password !== undefined ) params.password = password;
return this._http.requestWithPrefix(
callback, "POST", "/register", undefined,
{
username: username,
password: password,
auth: auth
}, httpApi.PREFIX_V2_ALPHA
params, httpApi.PREFIX_V2_ALPHA
);
};
@@ -1389,16 +1392,18 @@ function _PojoToMatrixEventMapper(plainOldJsObject) {
* @param {string} email
* @param {string} client_secret
* @param {string} send_attempt
* @param {string} next_link Optional
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixClient.prototype.requestEmailToken = function(email, client_secret,
send_attempt, callback) {
send_attempt, next_link, callback) {
var params = {
client_secret: client_secret,
email: email,
send_attempt: send_attempt
send_attempt: send_attempt,
next_link: next_link
};
return this._http.idServerRequest(
callback, "POST", "/validate/email/requestToken",