Merge pull request #3476 from matrix-org/jryans/msisdn-reg-submit-url

Send MSISDN validation token to submit_url during registration
This commit is contained in:
J. Ryan Stinnett 2019-09-25 11:30:33 +01:00 committed by GitHub
commit b248918aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -420,6 +420,7 @@ export const MsisdnAuthEntry = createReactClass({
}, },
componentWillMount: function() { componentWillMount: function() {
this._submitUrl = null;
this._sid = null; this._sid = null;
this._msisdn = null; this._msisdn = null;
this._tokenBox = null; this._tokenBox = null;
@ -442,6 +443,7 @@ export const MsisdnAuthEntry = createReactClass({
this.props.clientSecret, this.props.clientSecret,
1, // TODO: Multiple send attempts? 1, // TODO: Multiple send attempts?
).then((result) => { ).then((result) => {
this._submitUrl = result.submit_url;
this._sid = result.sid; this._sid = result.sid;
this._msisdn = result.msisdn; this._msisdn = result.msisdn;
}); });
@ -462,9 +464,16 @@ export const MsisdnAuthEntry = createReactClass({
}); });
try { try {
const result = await this.props.matrixClient.submitMsisdnToken( let result;
if (this._submitUrl) {
result = await this.props.matrixClient.submitMsisdnTokenOtherUrl(
this._submitUrl, this._sid, this.props.clientSecret, this.state.token,
);
} else {
result = await this.props.matrixClient.submitMsisdnToken(
this._sid, this.props.clientSecret, this.state.token, this._sid, this.props.clientSecret, this.state.token,
); );
}
if (result.success) { if (result.success) {
const creds = { const creds = {
sid: this._sid, sid: this._sid,