From 9e33be9b2a6b62f70a63756b9ad8c4d1314b9c7e Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 24 Sep 2019 15:42:35 +0100 Subject: [PATCH] Send MSISDN validation token to submit_url during registration Similar to previous changes for 3PID add, this changes registration with MSISDN to also send tokens to `submit_url` when supplied. Fixes https://github.com/vector-im/riot-web/issues/10939 --- .../views/auth/InteractiveAuthEntryComponents.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index af41d07720..145ef32643 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -420,6 +420,7 @@ export const MsisdnAuthEntry = createReactClass({ }, componentWillMount: function() { + this._submitUrl = null; this._sid = null; this._msisdn = null; this._tokenBox = null; @@ -442,6 +443,7 @@ export const MsisdnAuthEntry = createReactClass({ this.props.clientSecret, 1, // TODO: Multiple send attempts? ).then((result) => { + this._submitUrl = result.submit_url; this._sid = result.sid; this._msisdn = result.msisdn; }); @@ -462,9 +464,16 @@ export const MsisdnAuthEntry = createReactClass({ }); try { - const result = await this.props.matrixClient.submitMsisdnToken( - this._sid, this.props.clientSecret, this.state.token, - ); + 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, + ); + } if (result.success) { const creds = { sid: this._sid,