Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Skip .well-known discovery for free server type
Browse files Browse the repository at this point in the history
  • Loading branch information
jryans committed Jan 31, 2019
1 parent 6597db6 commit f58055c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/structures/auth/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ module.exports = React.createClass({
username: username,
discoveryError: null,
});
// If the free server type is selected, we don't show server details at all,
// so it doesn't make sense to try .well-known discovery.
if (this.state.serverType === ServerType.FREE) {
return;
}
if (username[0] === "@") {
const serverName = username.split(':').slice(1).join(':');
try {
Expand Down Expand Up @@ -385,6 +390,15 @@ module.exports = React.createClass({
this.setState({findingHomeserver: true});
try {
const discovery = await AutoDiscovery.findClientConfig(serverName);

// The server type may have changed while discovery began in the background.
// If it has become the free server type which doesn't show server details,
// ignore discovery results.
if (this.state.serverType === ServerType.FREE) {
this.setState({findingHomeserver: false});
return;
}

const state = discovery["m.homeserver"].state;
if (state !== AutoDiscovery.SUCCESS && state !== AutoDiscovery.PROMPT) {
this.setState({
Expand Down

0 comments on commit f58055c

Please sign in to comment.