1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00
Luke Barnard
2017-05-11 09:14:45 +01:00
committed by GitHub
parent 6021c1c6b1
commit cb9a9e8d50

View File

@@ -120,6 +120,20 @@ MatrixBaseApis.prototype.makeTxnId = function() {
// Registration/Login operations
// =============================
/**
* Check whether a username is available prior to registration. An error response
* indicates an invalid/unavailable username.
* @param {string} username The username to check the availability of.
* @return {module:client.Promise} Resolves: to `true`.
*/
MatrixBaseApis.prototype.isUsernameAvailable = function(username) {
return this._http.authedRequest(
undefined, "GET", '/register/available', { username: username },
).then((response) => {
return response.available;
});
};
/**
* @param {string} username
* @param {string} password