Remove dead code for empty matrixIdText
in PasswordLogin
This commit is contained in:
parent
350c24c503
commit
73aeb26a79
2 changed files with 8 additions and 18 deletions
|
@ -32,10 +32,6 @@ limitations under the License.
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Login_field_disabled {
|
|
||||||
opacity: 0.3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_Login_fieldLabel {
|
.mx_Login_fieldLabel {
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|
|
@ -158,10 +158,9 @@ class PasswordLogin extends React.Component {
|
||||||
this.props.onPasswordChanged(ev.target.value);
|
this.props.onPasswordChanged(ev.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLoginField(loginType, disabled) {
|
renderLoginField(loginType) {
|
||||||
const classes = {
|
const classes = {
|
||||||
mx_Login_field: true,
|
mx_Login_field: true,
|
||||||
mx_Login_field_disabled: disabled,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (loginType) {
|
switch (loginType) {
|
||||||
|
@ -169,7 +168,7 @@ class PasswordLogin extends React.Component {
|
||||||
classes.mx_Login_email = true;
|
classes.mx_Login_email = true;
|
||||||
classes.error = this.props.loginIncorrect && !this.state.username;
|
classes.error = this.props.loginIncorrect && !this.state.username;
|
||||||
return <input
|
return <input
|
||||||
className={classNames(classes)}
|
className="mx_Login_field"
|
||||||
ref={(e) => {this._loginField = e;}}
|
ref={(e) => {this._loginField = e;}}
|
||||||
key="email_input"
|
key="email_input"
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -179,7 +178,6 @@ class PasswordLogin extends React.Component {
|
||||||
placeholder="joe@example.com"
|
placeholder="joe@example.com"
|
||||||
value={this.state.username}
|
value={this.state.username}
|
||||||
autoFocus
|
autoFocus
|
||||||
disabled={disabled}
|
|
||||||
/>;
|
/>;
|
||||||
case PasswordLogin.LOGIN_FIELD_MXID:
|
case PasswordLogin.LOGIN_FIELD_MXID:
|
||||||
classes.mx_Login_username = true;
|
classes.mx_Login_username = true;
|
||||||
|
@ -198,7 +196,6 @@ class PasswordLogin extends React.Component {
|
||||||
}) : _t("User name")}
|
}) : _t("User name")}
|
||||||
value={this.state.username}
|
value={this.state.username}
|
||||||
autoFocus
|
autoFocus
|
||||||
disabled={disabled}
|
|
||||||
/>;
|
/>;
|
||||||
case PasswordLogin.LOGIN_FIELD_PHONE: {
|
case PasswordLogin.LOGIN_FIELD_PHONE: {
|
||||||
const CountryDropdown = sdk.getComponent('views.auth.CountryDropdown');
|
const CountryDropdown = sdk.getComponent('views.auth.CountryDropdown');
|
||||||
|
@ -212,7 +209,6 @@ class PasswordLogin extends React.Component {
|
||||||
value={this.state.phoneCountry}
|
value={this.state.phoneCountry}
|
||||||
isSmall={true}
|
isSmall={true}
|
||||||
showPrefix={true}
|
showPrefix={true}
|
||||||
disabled={disabled}
|
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
className={classNames(classes)}
|
className={classNames(classes)}
|
||||||
|
@ -224,7 +220,6 @@ class PasswordLogin extends React.Component {
|
||||||
placeholder={_t("Mobile phone number")}
|
placeholder={_t("Mobile phone number")}
|
||||||
value={this.state.phoneNumber}
|
value={this.state.phoneNumber}
|
||||||
autoFocus
|
autoFocus
|
||||||
disabled={disabled}
|
|
||||||
/>
|
/>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
@ -271,13 +266,12 @@ class PasswordLogin extends React.Component {
|
||||||
|
|
||||||
const pwFieldClass = classNames({
|
const pwFieldClass = classNames({
|
||||||
mx_Login_field: true,
|
mx_Login_field: true,
|
||||||
mx_Login_field_disabled: matrixIdText === '',
|
|
||||||
error: this.props.loginIncorrect && !this.isLoginEmpty(), // only error password if error isn't top field
|
error: this.props.loginIncorrect && !this.isLoginEmpty(), // only error password if error isn't top field
|
||||||
});
|
});
|
||||||
|
|
||||||
const Dropdown = sdk.getComponent('elements.Dropdown');
|
const Dropdown = sdk.getComponent('elements.Dropdown');
|
||||||
|
|
||||||
const loginField = this.renderLoginField(this.state.loginType, matrixIdText === '');
|
const loginField = this.renderLoginField(this.state.loginType);
|
||||||
|
|
||||||
let loginType;
|
let loginType;
|
||||||
if (!SdkConfig.get().disable_3pid_login) {
|
if (!SdkConfig.get().disable_3pid_login) {
|
||||||
|
@ -287,7 +281,6 @@ class PasswordLogin extends React.Component {
|
||||||
<Dropdown
|
<Dropdown
|
||||||
className="mx_Login_type_dropdown"
|
className="mx_Login_type_dropdown"
|
||||||
value={this.state.loginType}
|
value={this.state.loginType}
|
||||||
disabled={matrixIdText === ''}
|
|
||||||
onOptionChange={this.onLoginTypeChange}>
|
onOptionChange={this.onLoginTypeChange}>
|
||||||
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{ matrixIdText }</span>
|
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{ matrixIdText }</span>
|
||||||
<span key={PasswordLogin.LOGIN_FIELD_EMAIL}>{ _t('Email address') }</span>
|
<span key={PasswordLogin.LOGIN_FIELD_EMAIL}>{ _t('Email address') }</span>
|
||||||
|
@ -297,8 +290,6 @@ class PasswordLogin extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const disableSubmit = this.props.disableSubmit || matrixIdText === '';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={this.onSubmitForm}>
|
<form onSubmit={this.onSubmitForm}>
|
||||||
|
@ -308,11 +299,14 @@ class PasswordLogin extends React.Component {
|
||||||
name="password"
|
name="password"
|
||||||
value={this.state.password} onChange={this.onPasswordChanged}
|
value={this.state.password} onChange={this.onPasswordChanged}
|
||||||
placeholder={_t('Password')}
|
placeholder={_t('Password')}
|
||||||
disabled={matrixIdText === ''}
|
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
{ forgotPasswordJsx }
|
{ forgotPasswordJsx }
|
||||||
<input className="mx_Login_submit" type="submit" value={_t('Sign in')} disabled={disableSubmit} />
|
<input className="mx_Login_submit"
|
||||||
|
type="submit"
|
||||||
|
value={_t('Sign in')}
|
||||||
|
disabled={this.props.disableSubmit}
|
||||||
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue