Remove id_server for MSISDN registration

For HSes that no longer need it, remove the id_server param when verifying
MSISDNs at registration.

Fixes https://github.com/vector-im/riot-web/issues/10941
pull/21833/head
J. Ryan Stinnett 2019-09-24 15:02:30 +01:00
parent 0c51e41ea4
commit ec9e7f5855
1 changed files with 22 additions and 22 deletions

View File

@ -453,45 +453,45 @@ export const MsisdnAuthEntry = createReactClass({
}); });
}, },
_onFormSubmit: function(e) { _onFormSubmit: async function(e) {
e.preventDefault(); e.preventDefault();
if (this.state.token == '') return; if (this.state.token == '') return;
this.setState({ this.setState({
errorText: null, errorText: null,
}); });
this.props.matrixClient.submitMsisdnToken( try {
this._sid, this.props.clientSecret, this.state.token, const result = await this.props.matrixClient.submitMsisdnToken(
).then((result) => { this._sid, this.props.clientSecret, this.state.token,
);
if (result.success) { if (result.success) {
const idServerParsedUrl = url.parse( const creds = {
this.props.matrixClient.getIdentityServerUrl(), sid: this._sid,
); client_secret: this.props.clientSecret,
};
if (await this.props.matrixClient.doesServerRequireIdServerParam()) {
const idServerParsedUrl = url.parse(
this.props.matrixClient.getIdentityServerUrl(),
);
creds.id_server = idServerParsedUrl.host;
}
this.props.submitAuthDict({ this.props.submitAuthDict({
type: MsisdnAuthEntry.LOGIN_TYPE, type: MsisdnAuthEntry.LOGIN_TYPE,
// TODO: Remove `threepid_creds` once servers support proper UIA // TODO: Remove `threepid_creds` once servers support proper UIA
// See https://github.com/vector-im/riot-web/issues/10312 // See https://github.com/vector-im/riot-web/issues/10312
threepid_creds: { threepid_creds: creds,
sid: this._sid, threepidCreds: creds,
client_secret: this.props.clientSecret,
id_server: idServerParsedUrl.host,
},
threepidCreds: {
sid: this._sid,
client_secret: this.props.clientSecret,
id_server: idServerParsedUrl.host,
},
}); });
} else { } else {
this.setState({ this.setState({
errorText: _t("Token incorrect"), errorText: _t("Token incorrect"),
}); });
} }
}).catch((e) => { } catch (e) {
this.props.fail(e); this.props.fail(e);
console.log("Failed to submit msisdn token"); console.log("Failed to submit msisdn token");
}).done(); }
}, },
render: function() { render: function() {