From 5600a9d02adc61f9420234a4090d9342743443db Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 21 Nov 2018 14:14:08 -0700 Subject: [PATCH] Validate the identity server --- src/components/structures/login/Login.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js index fae7cc37df..6002f058f4 100644 --- a/src/components/structures/login/Login.js +++ b/src/components/structures/login/Login.js @@ -115,11 +115,6 @@ module.exports = React.createClass({ // discovery went wrong if (this.state.discoveryError) return; - if (this.state.discoveredHsUrl) { - console.log("Rewriting username because the homeserver was discovered"); - username = username.substring(1).split(":")[0]; - } - this.setState({ busy: true, errorText: null, @@ -327,16 +322,13 @@ module.exports = React.createClass({ return; } - // XXX: We don't verify the identity server URL because sydent doesn't register - // the route we need. - - // console.log("Verifying identity server URL: " + isUrl); - // const isResponse = await this._getWellKnownObject(`${isUrl}/_matrix/identity/api/v1`); - // if (!isResponse) { - // console.error("Invalid /api/v1 response"); - // this.setState({discoveryError: _t("Invalid homeserver discovery response")}); - // return; - // } + console.log("Verifying identity server URL: " + isUrl); + const isResponse = await this._getWellKnownObject(`${isUrl}/_matrix/identity/api/v1`); + if (!isResponse) { + console.error("Invalid /api/v1 response"); + this.setState({discoveryError: _t("Invalid homeserver discovery response")}); + return; + } } this.setState({discoveredHsUrl: hsUrl, discoveredIsUrl: isUrl, discoveryError: ""});