1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Expose the inhibit_login flag to register

This commit is contained in:
David Baker
2019-06-13 16:23:11 +01:00
parent 012cbf7995
commit 8aeb994839

View File

@@ -151,13 +151,14 @@ MatrixBaseApis.prototype.isUsernameAvailable = function(username) {
* threepid uses during registration in the ID server. Set 'msisdn' to * threepid uses during registration in the ID server. Set 'msisdn' to
* true to bind msisdn. * true to bind msisdn.
* @param {string} guestAccessToken * @param {string} guestAccessToken
* @param {string} inhibitLogin
* @param {module:client.callback} callback Optional. * @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO * @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
MatrixBaseApis.prototype.register = function( MatrixBaseApis.prototype.register = function(
username, password, username, password,
sessionId, auth, bindThreepids, guestAccessToken, sessionId, auth, bindThreepids, guestAccessToken, inhibitLogin,
callback, callback,
) { ) {
// backwards compat // backwards compat
@@ -166,6 +167,10 @@ MatrixBaseApis.prototype.register = function(
} else if (bindThreepids === null || bindThreepids === undefined) { } else if (bindThreepids === null || bindThreepids === undefined) {
bindThreepids = {}; bindThreepids = {};
} }
if (typeof inhibit_login === 'function') {
callback = inhibitLogin;
inhibitLogin = undefined;
}
if (auth === undefined || auth === null) { if (auth === undefined || auth === null) {
auth = {}; auth = {};
@@ -192,6 +197,9 @@ MatrixBaseApis.prototype.register = function(
if (guestAccessToken !== undefined && guestAccessToken !== null) { if (guestAccessToken !== undefined && guestAccessToken !== null) {
params.guest_access_token = guestAccessToken; params.guest_access_token = guestAccessToken;
} }
if (inhibitLogin !== undefined && inhibitLogin !== null) {
params.inhibit_login = inhibitLogin;
}
// Temporary parameter added to make the register endpoint advertise // Temporary parameter added to make the register endpoint advertise
// msisdn flows. This exists because there are clients that break // msisdn flows. This exists because there are clients that break
// when given stages they don't recognise. This parameter will cease // when given stages they don't recognise. This parameter will cease