Merge pull request #2972 from matrix-org/travis/wk/mxid
Restore use of full mxid login
This commit is contained in:
commit
3e10d3ceea
1 changed files with 13 additions and 9 deletions
|
@ -24,8 +24,8 @@ import {_t, _td} from '../../../languageHandler';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import Login from '../../../Login';
|
import Login from '../../../Login';
|
||||||
import SdkConfig from '../../../SdkConfig';
|
import SdkConfig from '../../../SdkConfig';
|
||||||
import {messageForResourceLimitError} from '../../../utils/ErrorUtils';
|
import { messageForResourceLimitError } from '../../../utils/ErrorUtils';
|
||||||
import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
|
import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
|
||||||
|
|
||||||
// For validating phone numbers without country codes
|
// For validating phone numbers without country codes
|
||||||
const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/;
|
const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/;
|
||||||
|
@ -235,21 +235,25 @@ module.exports = React.createClass({
|
||||||
this.setState({ username: username });
|
this.setState({ username: username });
|
||||||
},
|
},
|
||||||
|
|
||||||
onUsernameBlur: function(username) {
|
onUsernameBlur: async function(username) {
|
||||||
this.setState({
|
this.setState({
|
||||||
username: username,
|
username: username,
|
||||||
|
busy: true, // unset later by the result of onServerConfigChange
|
||||||
errorText: null,
|
errorText: null,
|
||||||
});
|
});
|
||||||
if (username[0] === "@" && false) { // TODO: TravisR - Restore this
|
if (username[0] === "@") {
|
||||||
const serverName = username.split(':').slice(1).join(':');
|
const serverName = username.split(':').slice(1).join(':');
|
||||||
try {
|
try {
|
||||||
// we have to append 'https://' to make the URL constructor happy
|
const result = await AutoDiscoveryUtils.validateServerName(serverName);
|
||||||
// otherwise we get things like 'protocol: matrix.org, pathname: 8448'
|
this.props.onServerConfigChange(result);
|
||||||
const url = new URL("https://" + serverName);
|
|
||||||
this._tryWellKnownDiscovery(url.hostname);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Problem parsing URL or unhandled error doing .well-known discovery:", e);
|
console.error("Problem parsing URL or unhandled error doing .well-known discovery:", e);
|
||||||
this.setState({errorText: _t("Failed to perform homeserver discovery")});
|
|
||||||
|
let message = _t("Failed to perform homeserver discovery");
|
||||||
|
if (e.translatedMessage) {
|
||||||
|
message = e.translatedMessage;
|
||||||
|
}
|
||||||
|
this.setState({errorText: message, busy: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue