1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Fix email registration

This would cause the request to 400 in the new vector that opens after you clicked the link in the email, as per the comment.
This commit is contained in:
David Baker
2016-07-29 14:40:53 +01:00
parent 61cf53deee
commit f63015e4c4

View File

@@ -2423,11 +2423,20 @@ MatrixClient.prototype.register = function(username, password,
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
MatrixClient.prototype.registerRequest = function(data, kind, callback) { MatrixClient.prototype.registerRequest = function(data, kind, callback) {
var request_data = { var request_data = {};
// only add these if the app is sending something other than auth data
// subsequent calls to register with the same session will
// overwrite the parameters if any are passed, so it's important
// that if the app give no data, we send no data.
var number_of_params = Object.keys(data).length;
if (data.auth) --number_of_params;
if (number_of_params > 0) {
request_data = {
device_id: this.deviceId, device_id: this.deviceId,
initial_device_display_name: this.defaultDeviceDisplayName, initial_device_display_name: this.defaultDeviceDisplayName,
}; };
}
// merge data into request_data // merge data into request_data
for (var k in data) { for (var k in data) {
if (data.hasOwnProperty(k)) { request_data[k] = data[k]; } if (data.hasOwnProperty(k)) { request_data[k] = data[k]; }