replace some of the status.im theme with general config options
This commit is contained in:
parent
a0cdaf29f9
commit
2827bc0718
7 changed files with 37 additions and 24 deletions
|
@ -24,7 +24,6 @@ import Modal from "../../../Modal";
|
||||||
import MatrixClientPeg from "../../../MatrixClientPeg";
|
import MatrixClientPeg from "../../../MatrixClientPeg";
|
||||||
|
|
||||||
import PasswordReset from "../../../PasswordReset";
|
import PasswordReset from "../../../PasswordReset";
|
||||||
import UserSettingsStore from "../../../UserSettingsStore";
|
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'ForgotPassword',
|
displayName: 'ForgotPassword',
|
||||||
|
@ -184,10 +183,8 @@ module.exports = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let theme = UserSettingsStore.getTheme();
|
|
||||||
|
|
||||||
let serverConfigSection;
|
let serverConfigSection;
|
||||||
if (theme !== 'status') {
|
if (!config.disable_custom_urls) {
|
||||||
serverConfigSection = (
|
serverConfigSection = (
|
||||||
<ServerConfig ref="serverConfig"
|
<ServerConfig ref="serverConfig"
|
||||||
withToggleButton={true}
|
withToggleButton={true}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import sdk from '../../../index';
|
||||||
import Login from '../../../Login';
|
import Login from '../../../Login';
|
||||||
import UserSettingsStore from '../../../UserSettingsStore';
|
import UserSettingsStore from '../../../UserSettingsStore';
|
||||||
import PlatformPeg from '../../../PlatformPeg';
|
import PlatformPeg from '../../../PlatformPeg';
|
||||||
|
import SdkConfig from '../../../SdkConfig';
|
||||||
|
|
||||||
// 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]*$/;
|
||||||
|
@ -105,12 +106,17 @@ module.exports = React.createClass({
|
||||||
if (error.httpStatus == 400 && usingEmail) {
|
if (error.httpStatus == 400 && usingEmail) {
|
||||||
errorText = _t('This Home Server does not support login using email address.');
|
errorText = _t('This Home Server does not support login using email address.');
|
||||||
} else if (error.httpStatus === 401 || error.httpStatus === 403) {
|
} else if (error.httpStatus === 401 || error.httpStatus === 403) {
|
||||||
const theme = UserSettingsStore.getTheme();
|
if (SdkConfig.get().disable_custom_urls) {
|
||||||
if (theme === "status") {
|
|
||||||
errorText = (
|
errorText = (
|
||||||
<div>
|
<div>
|
||||||
<div>Incorrect username and/or password.</div>
|
<div>{ _t('Incorrect username and/or password.') }</div>
|
||||||
<div className="mx_Login_smallError">Please note you are logging into the matrix.status.im server, not matrix.org.</div>
|
<div className="mx_Login_smallError">
|
||||||
|
{ _t('Please note you are logging into the %(hs)s server, not matrix.org.',
|
||||||
|
{
|
||||||
|
hs: this.props.defaultHsUrl.replace(/^https?:\/\//, '')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -345,10 +351,8 @@ module.exports = React.createClass({
|
||||||
const ServerConfig = sdk.getComponent("login.ServerConfig");
|
const ServerConfig = sdk.getComponent("login.ServerConfig");
|
||||||
const loader = this.state.busy ? <div className="mx_Login_loader"><Loader /></div> : null;
|
const loader = this.state.busy ? <div className="mx_Login_loader"><Loader /></div> : null;
|
||||||
|
|
||||||
const theme = UserSettingsStore.getTheme();
|
|
||||||
|
|
||||||
let loginAsGuestJsx;
|
let loginAsGuestJsx;
|
||||||
if (this.props.enableGuest && theme !== 'status') {
|
if (this.props.enableGuest) {
|
||||||
loginAsGuestJsx =
|
loginAsGuestJsx =
|
||||||
<a className="mx_Login_create" onClick={this._onLoginAsGuestClick} href="#">
|
<a className="mx_Login_create" onClick={this._onLoginAsGuestClick} href="#">
|
||||||
{ _t('Login as guest') }
|
{ _t('Login as guest') }
|
||||||
|
@ -366,9 +370,7 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let serverConfig;
|
if (!SdkConfig.get().disable_custom_urls) {
|
||||||
let header;
|
|
||||||
if (theme !== 'status') {
|
|
||||||
serverConfig = <ServerConfig ref="serverConfig"
|
serverConfig = <ServerConfig ref="serverConfig"
|
||||||
withToggleButton={true}
|
withToggleButton={true}
|
||||||
customHsUrl={this.props.customHsUrl}
|
customHsUrl={this.props.customHsUrl}
|
||||||
|
@ -377,7 +379,14 @@ module.exports = React.createClass({
|
||||||
defaultIsUrl={this.props.defaultIsUrl}
|
defaultIsUrl={this.props.defaultIsUrl}
|
||||||
onServerConfigChange={this.onServerConfigChange}
|
onServerConfigChange={this.onServerConfigChange}
|
||||||
delayTimeMs={1000} />;
|
delayTimeMs={1000} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
let serverConfig;
|
||||||
|
let header;
|
||||||
|
|
||||||
|
// FIXME: remove status.im theme tweaks
|
||||||
|
const theme = UserSettingsStore.getTheme();
|
||||||
|
if (theme !== "status") {
|
||||||
header = <h2>{ _t('Sign in') }</h2>;
|
header = <h2>{ _t('Sign in') }</h2>;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -409,7 +418,7 @@ module.exports = React.createClass({
|
||||||
</a>
|
</a>
|
||||||
{ loginAsGuestJsx }
|
{ loginAsGuestJsx }
|
||||||
{ returnToAppJsx }
|
{ returnToAppJsx }
|
||||||
{ theme !== 'status' ? this._renderLanguageSetting() : '' }
|
{ !SdkConfig.get().disable_login_language_selector ? this._renderLanguageSetting() : '' }
|
||||||
<LoginFooter />
|
<LoginFooter />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,6 +27,7 @@ import RegistrationForm from '../../views/login/RegistrationForm';
|
||||||
import RtsClient from '../../../RtsClient';
|
import RtsClient from '../../../RtsClient';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import UserSettingsStore from '../../../UserSettingsStore';
|
import UserSettingsStore from '../../../UserSettingsStore';
|
||||||
|
import SdkConfig from '../../../SdkConfig';
|
||||||
|
|
||||||
const MIN_PASSWORD_LENGTH = 6;
|
const MIN_PASSWORD_LENGTH = 6;
|
||||||
|
|
||||||
|
@ -351,7 +352,7 @@ module.exports = React.createClass({
|
||||||
registerBody = <Spinner />;
|
registerBody = <Spinner />;
|
||||||
} else {
|
} else {
|
||||||
let serverConfigSection;
|
let serverConfigSection;
|
||||||
if (theme !== 'status') {
|
if (!SdkConfig.get().disable_custom_urls) {
|
||||||
serverConfigSection = (
|
serverConfigSection = (
|
||||||
<ServerConfig ref="serverConfig"
|
<ServerConfig ref="serverConfig"
|
||||||
withToggleButton={true}
|
withToggleButton={true}
|
||||||
|
@ -397,6 +398,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
let header;
|
let header;
|
||||||
let errorText;
|
let errorText;
|
||||||
|
// FIXME: remove hardcoded Status team tweaks at some point
|
||||||
if (theme === 'status' && this.state.errorText) {
|
if (theme === 'status' && this.state.errorText) {
|
||||||
header = <div className="mx_Login_error">{ this.state.errorText }</div>;
|
header = <div className="mx_Login_error">{ this.state.errorText }</div>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ module.exports = React.createClass({
|
||||||
displayName: 'LoginPage',
|
displayName: 'LoginPage',
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
// FIXME: this should be turned into a proper skin with a StatusLoginPage component
|
||||||
if (UserSettingsStore.getTheme() === 'status') {
|
if (UserSettingsStore.getTheme() === 'status') {
|
||||||
return (
|
return (
|
||||||
<div className="mx_StatusLogin">
|
<div className="mx_StatusLogin">
|
||||||
|
|
|
@ -20,7 +20,7 @@ import classNames from 'classnames';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import {field_input_incorrect} from '../../../UiEffects';
|
import {field_input_incorrect} from '../../../UiEffects';
|
||||||
import UserSettingsStore from '../../../UserSettingsStore';
|
import SdkConfig from '../../../SdkConfig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pure UI component which displays a username/password form.
|
* A pure UI component which displays a username/password form.
|
||||||
|
@ -122,8 +122,6 @@ class PasswordLogin extends React.Component {
|
||||||
mx_Login_field_disabled: disabled,
|
mx_Login_field_disabled: disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
const theme = UserSettingsStore.getTheme();
|
|
||||||
|
|
||||||
switch(loginType) {
|
switch(loginType) {
|
||||||
case PasswordLogin.LOGIN_FIELD_EMAIL:
|
case PasswordLogin.LOGIN_FIELD_EMAIL:
|
||||||
classes.mx_Login_email = true;
|
classes.mx_Login_email = true;
|
||||||
|
@ -146,7 +144,10 @@ class PasswordLogin extends React.Component {
|
||||||
type="text"
|
type="text"
|
||||||
name="username" // make it a little easier for browser's remember-password
|
name="username" // make it a little easier for browser's remember-password
|
||||||
onChange={this.onUsernameChanged}
|
onChange={this.onUsernameChanged}
|
||||||
placeholder={theme === 'status' ? "Username on matrix.status.im" : _t("User name")}
|
placeholder={ SdkConfig.get().disable_custom_urls ?
|
||||||
|
_t("Username on %(hs)s", {
|
||||||
|
hs: this.props.hsUrl.replace(/^https?:\/\//, '')
|
||||||
|
}) : _t("User name")}
|
||||||
value={this.state.username}
|
value={this.state.username}
|
||||||
autoFocus
|
autoFocus
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
@ -212,9 +213,8 @@ class PasswordLogin extends React.Component {
|
||||||
|
|
||||||
const loginField = this.renderLoginField(this.state.loginType, matrixIdText === '');
|
const loginField = this.renderLoginField(this.state.loginType, matrixIdText === '');
|
||||||
|
|
||||||
const theme = UserSettingsStore.getTheme();
|
|
||||||
let loginType;
|
let loginType;
|
||||||
if (theme !== 'status') {
|
if (!SdkConfig.get().disable_3pid_login) {
|
||||||
loginType = (
|
loginType = (
|
||||||
<div className="mx_Login_type_container">
|
<div className="mx_Login_type_container">
|
||||||
<label className="mx_Login_type_label">{ _t('Sign in with') }</label>
|
<label className="mx_Login_type_label">{ _t('Sign in with') }</label>
|
||||||
|
|
|
@ -23,6 +23,7 @@ import { looksValid as phoneNumberLooksValid } from '../../../phonenumber';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import UserSettingsStore from '../../../UserSettingsStore';
|
import UserSettingsStore from '../../../UserSettingsStore';
|
||||||
|
import SdkConfig from '../../../SdkConfig';
|
||||||
|
|
||||||
const FIELD_EMAIL = 'field_email';
|
const FIELD_EMAIL = 'field_email';
|
||||||
const FIELD_PHONE_COUNTRY = 'field_phone_country';
|
const FIELD_PHONE_COUNTRY = 'field_phone_country';
|
||||||
|
@ -275,6 +276,7 @@ module.exports = React.createClass({
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
const theme = UserSettingsStore.getTheme();
|
const theme = UserSettingsStore.getTheme();
|
||||||
|
// FIXME: remove hardcoded Status team tweaks at some point
|
||||||
const emailPlaceholder = theme === 'status' ? _t("Email address") : _t("Email address (optional)");
|
const emailPlaceholder = theme === 'status' ? _t("Email address") : _t("Email address (optional)");
|
||||||
|
|
||||||
const emailSection = (
|
const emailSection = (
|
||||||
|
@ -311,7 +313,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
|
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
|
||||||
let phoneSection;
|
let phoneSection;
|
||||||
if (theme !== "status") {
|
if (!SdkConfig.get().disable_3pid_login) {
|
||||||
phoneSection = (
|
phoneSection = (
|
||||||
<div className="mx_Login_phoneSection">
|
<div className="mx_Login_phoneSection">
|
||||||
<CountryDropdown ref="phone_country" onOptionChange={this._onPhoneCountryChange}
|
<CountryDropdown ref="phone_country" onOptionChange={this._onPhoneCountryChange}
|
||||||
|
|
|
@ -928,5 +928,7 @@
|
||||||
"The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.": "The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.",
|
"The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.": "The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.",
|
||||||
"File to import": "File to import",
|
"File to import": "File to import",
|
||||||
"Import": "Import",
|
"Import": "Import",
|
||||||
"Status.im theme": "Status.im theme"
|
"Status.im theme": "Status.im theme",
|
||||||
|
"Please note you are logging into the %(hs)s server, not matrix.org.": "Please note you are logging into the %(hs)s server, not matrix.org.",
|
||||||
|
"Username on %(hs)s": "Username on %(hs)s"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue