Guard against misconfigured homeservers when adding / binding phone numbers
This ensures we only fallback to submitting MSISDN tokens to the identity server when we expect to do. Unexpected cases will now throw an error. Fixes https://github.com/vector-im/riot-web/issues/10936
This commit is contained in:
parent
54cea6a5e3
commit
b38c7fc411
2 changed files with 12 additions and 4 deletions
|
@ -475,22 +475,26 @@ export const MsisdnAuthEntry = createReactClass({
|
|||
});
|
||||
|
||||
try {
|
||||
const requiresIdServerParam =
|
||||
await this.props.matrixClient.doesServerRequireIdServerParam();
|
||||
let result;
|
||||
if (this._submitUrl) {
|
||||
result = await this.props.matrixClient.submitMsisdnTokenOtherUrl(
|
||||
this._submitUrl, this._sid, this.props.clientSecret, this.state.token,
|
||||
);
|
||||
} else {
|
||||
} else if (requiresIdServerParam) {
|
||||
result = await this.props.matrixClient.submitMsisdnToken(
|
||||
this._sid, this.props.clientSecret, this.state.token,
|
||||
);
|
||||
} else {
|
||||
throw new Error("The registration with MSISDN flow is misconfigured");
|
||||
}
|
||||
if (result.success) {
|
||||
const creds = {
|
||||
sid: this._sid,
|
||||
client_secret: this.props.clientSecret,
|
||||
};
|
||||
if (await this.props.matrixClient.doesServerRequireIdServerParam()) {
|
||||
if (requiresIdServerParam) {
|
||||
const idServerParsedUrl = url.parse(
|
||||
this.props.matrixClient.getIdentityServerUrl(),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue