From 5f68f1313bb76ab98fa14f51735484cf1b5e2000 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 15 Mar 2016 23:01:59 +0000 Subject: [PATCH] show warning if guest login disabled --- src/components/structures/MatrixChat.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index df27d38172..a47622b236 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -191,7 +191,7 @@ module.exports = React.createClass({ } }, - _registerAsGuest: function() { + _registerAsGuest: function(showWarning) { var self = this; console.log("Doing guest login on %s", this.getCurrentHsUrl()); var hsUrl = this.getCurrentHsUrl(); @@ -209,6 +209,13 @@ module.exports = React.createClass({ guest: true }); }, function(err) { + if (showWarning) { + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Failed to login as guest", + description: err.data + }); + } console.error("Failed to register as guest: " + err + " " + err.data); self._setAutoRegisterAsGuest(false); }); @@ -1064,7 +1071,7 @@ module.exports = React.createClass({ customHsUrl={this.getCurrentHsUrl()} customIsUrl={this.getCurrentIsUrl()} onForgotPasswordClick={this.onForgotPasswordClick} - onLoginAsGuestClick={this.props.enableGuest && this.props.config && this.props.config.default_hs_url ? this._registerAsGuest: undefined} + onLoginAsGuestClick={this.props.enableGuest && this.props.config && this.props.config.default_hs_url ? this._registerAsGuest.bind(this, true) : undefined} /> ); }