diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js index 356439b0cc..ef6b095da0 100644 --- a/src/components/structures/login/Login.js +++ b/src/components/structures/login/Login.js @@ -129,11 +129,30 @@ module.exports = React.createClass({displayName: 'Login', if (!errCode && err.httpStatus) { errCode = "HTTP " + err.httpStatus; } - this.setState({ - errorText: ( - "Error: Problem communicating with the given homeserver " + + + var errorText = "Error: Problem communicating with the given homeserver " + (errCode ? "(" + errCode + ")" : "") - ) + + if (err.cors === 'rejected') { + if (window.location.protocol === 'https:' && + (this.state.enteredHomeserverUrl.startsWith("http:") || + !this.state.enteredHomeserverUrl.startsWith("http"))) + { + errorText = + Can't connect to homeserver via HTTP when using a vector served by HTTPS. + Either use HTTPS or enable unsafe scripts + ; + } + else { + errorText = + Can't connect to homeserver - please check your connectivity and ensure + your homeserver's SSL certificate is trusted. + ; + } + } + + this.setState({ + errorText: errorText }); },