From 1f78b59a0e936be39a8377fc541b68770e67be3c Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" <jryans@gmail.com> Date: Tue, 29 Jan 2019 12:23:01 -0600 Subject: [PATCH] Add create your account header --- src/components/structures/auth/Registration.js | 2 ++ src/components/views/auth/RegistrationForm.js | 17 +++++++++++++++++ src/i18n/strings/en_EN.json | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index e761ac74b0..a330b20739 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -443,6 +443,8 @@ module.exports = React.createClass({ onError={this.onFormValidationFailed} onRegisterClick={this.onFormSubmit} flows={this.state.flows} + hsUrl={this.state.hsUrl} + hsName={this.props.defaultServerName} />; } }, diff --git a/src/components/views/auth/RegistrationForm.js b/src/components/views/auth/RegistrationForm.js index 571040188b..bd967a0f6e 100644 --- a/src/components/views/auth/RegistrationForm.js +++ b/src/components/views/auth/RegistrationForm.js @@ -256,6 +256,22 @@ module.exports = React.createClass({ render: function() { const self = this; + let yourMatrixAccountText = _t('Create your account'); + if (this.props.hsName) { + yourMatrixAccountText = _t('Create your %(serverName)s account', { + serverName: this.props.hsName, + }); + } else { + try { + const parsedHsUrl = new URL(this.props.hsUrl); + yourMatrixAccountText = _t('Create your %(serverName)s account', { + serverName: parsedHsUrl.hostname, + }); + } catch (e) { + // ignore + } + } + const emailPlaceholder = this._authStepIsRequired('m.login.email.identity') ? _t("Email address") : _t("Email address (optional)"); @@ -309,6 +325,7 @@ module.exports = React.createClass({ return ( <div> + <h3>{yourMatrixAccountText}</h3> <form onSubmit={this.onSubmit}> { emailSection } { phoneSection } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 296165de9f..c90e368082 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1200,6 +1200,8 @@ "Sign in with": "Sign in with", "Sign in": "Sign in", "If you don't specify an email address, you won't be able to reset your password. Are you sure?": "If you don't specify an email address, you won't be able to reset your password. Are you sure?", + "Create your account": "Create your account", + "Create your %(serverName)s account": "Create your %(serverName)s account", "Email address (optional)": "Email address (optional)", "Mobile phone number (optional)": "Mobile phone number (optional)", "Other servers": "Other servers", @@ -1416,7 +1418,6 @@ "A phone number is required to register on this homeserver.": "A phone number is required to register on this homeserver.", "You need to enter a username.": "You need to enter a username.", "An unknown error occurred.": "An unknown error occurred.", - "Create your account": "Create your account", "Commands": "Commands", "Results from DuckDuckGo": "Results from DuckDuckGo", "Emoji": "Emoji",