From d96e814a92423a66f6c24e7868145a4900a29285 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 28 Jan 2019 16:13:19 -0600 Subject: [PATCH] Add link to edit server details --- res/css/views/auth/_AuthBody.scss | 6 ++++++ src/components/structures/auth/Login.js | 18 ++++++++++++++++++ src/components/views/auth/PasswordLogin.js | 15 ++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/res/css/views/auth/_AuthBody.scss b/res/css/views/auth/_AuthBody.scss index 21641978b6..d0df97a8e1 100644 --- a/res/css/views/auth/_AuthBody.scss +++ b/res/css/views/auth/_AuthBody.scss @@ -36,6 +36,12 @@ limitations under the License. color: $primary-fg-color; } +.mx_Auth_editServerDetails { + padding-left: 1em; + font-size: 12px; + font-weight: normal; +} + .mx_AuthBody a:link, .mx_AuthBody a:hover, .mx_AuthBody a:visited { diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 8dd21c2d5c..64d35134f1 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -360,6 +360,14 @@ module.exports = React.createClass({ }); }, + onEditServerDetailsClick(ev) { + ev.preventDefault(); + ev.stopPropagation(); + this.setState({ + phase: PHASE_SERVER_DETAILS, + }); + }, + _tryWellKnownDiscovery: async function(serverName) { if (!serverName.trim()) { // Nothing to discover @@ -605,10 +613,20 @@ module.exports = React.createClass({ _renderPasswordStep: function() { const PasswordLogin = sdk.getComponent('auth.PasswordLogin'); + let onEditServerDetailsClick = null; + // If custom URLs are allowed and we haven't selected the Free server type, wire + // up the server details edit link. + if ( + !SdkConfig.get()['disable_custom_urls'] && + this.state.serverType !== ServerType.FREE + ) { + onEditServerDetailsClick = this.onEditServerDetailsClick; + } return ( + {_t('Edit')} + ; + } + const pwFieldClass = classNames({ mx_Login_field: true, error: this.props.loginIncorrect && !this.isLoginEmpty(), // only error password if error isn't top field @@ -289,7 +299,10 @@ class PasswordLogin extends React.Component { return (
-

{ yourMatrixAccountText }

+

+ {yourMatrixAccountText} + {editLink} +

{ loginType } { loginField }