Merge pull request #906 from matrix-org/luke/revert-login-username-prefix-suffix
Remove suffix and prefix from login input username
This commit is contained in:
commit
276d3cad9c
2 changed files with 10 additions and 35 deletions
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import url from 'url';
|
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import Login from '../../../Login';
|
import Login from '../../../Login';
|
||||||
|
|
||||||
|
@ -242,12 +241,6 @@ module.exports = React.createClass({
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 'm.login.password':
|
case 'm.login.password':
|
||||||
const PasswordLogin = sdk.getComponent('login.PasswordLogin');
|
const PasswordLogin = sdk.getComponent('login.PasswordLogin');
|
||||||
// HSs that are not matrix.org may not be configured to have their
|
|
||||||
// domain name === domain part.
|
|
||||||
let hsDomain = url.parse(this.state.enteredHomeserverUrl).hostname;
|
|
||||||
if (hsDomain !== 'matrix.org') {
|
|
||||||
hsDomain = null;
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<PasswordLogin
|
<PasswordLogin
|
||||||
onSubmit={this.onPasswordLogin}
|
onSubmit={this.onPasswordLogin}
|
||||||
|
@ -259,7 +252,6 @@ module.exports = React.createClass({
|
||||||
onPhoneNumberChanged={this.onPhoneNumberChanged}
|
onPhoneNumberChanged={this.onPhoneNumberChanged}
|
||||||
onForgotPasswordClick={this.props.onForgotPasswordClick}
|
onForgotPasswordClick={this.props.onForgotPasswordClick}
|
||||||
loginIncorrect={this.state.loginIncorrect}
|
loginIncorrect={this.state.loginIncorrect}
|
||||||
hsDomain={hsDomain}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'm.login.cas':
|
case 'm.login.cas':
|
||||||
|
|
|
@ -121,32 +121,16 @@ class PasswordLogin extends React.Component {
|
||||||
autoFocus
|
autoFocus
|
||||||
/>;
|
/>;
|
||||||
case PasswordLogin.LOGIN_FIELD_MXID:
|
case PasswordLogin.LOGIN_FIELD_MXID:
|
||||||
const mxidInputClasses = classNames({
|
return <input
|
||||||
"mx_Login_field": true,
|
className="mx_Login_field mx_Login_username"
|
||||||
"mx_Login_username": true,
|
key="username_input"
|
||||||
"mx_Login_field_has_prefix": true,
|
type="text"
|
||||||
"mx_Login_field_has_suffix": Boolean(this.props.hsDomain),
|
name="username" // make it a little easier for browser's remember-password
|
||||||
});
|
onChange={this.onUsernameChanged}
|
||||||
let suffix = null;
|
placeholder="username"
|
||||||
if (this.props.hsDomain) {
|
value={this.state.username}
|
||||||
suffix = <div className="mx_Login_field_suffix">
|
autoFocus
|
||||||
:{this.props.hsDomain}
|
/>;
|
||||||
</div>;
|
|
||||||
}
|
|
||||||
return <div className="mx_Login_field_group">
|
|
||||||
<div className="mx_Login_field_prefix">@</div>
|
|
||||||
<input
|
|
||||||
className={mxidInputClasses}
|
|
||||||
key="username_input"
|
|
||||||
type="text"
|
|
||||||
name="username" // make it a little easier for browser's remember-password
|
|
||||||
onChange={this.onUsernameChanged}
|
|
||||||
placeholder="username"
|
|
||||||
value={this.state.username}
|
|
||||||
autoFocus
|
|
||||||
/>
|
|
||||||
{suffix}
|
|
||||||
</div>;
|
|
||||||
case PasswordLogin.LOGIN_FIELD_PHONE:
|
case PasswordLogin.LOGIN_FIELD_PHONE:
|
||||||
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
|
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
|
||||||
return <div className="mx_Login_phoneSection">
|
return <div className="mx_Login_phoneSection">
|
||||||
|
@ -237,7 +221,6 @@ PasswordLogin.propTypes = {
|
||||||
onPhoneNumberChanged: React.PropTypes.func,
|
onPhoneNumberChanged: React.PropTypes.func,
|
||||||
onPasswordChanged: React.PropTypes.func,
|
onPasswordChanged: React.PropTypes.func,
|
||||||
loginIncorrect: React.PropTypes.bool,
|
loginIncorrect: React.PropTypes.bool,
|
||||||
hsDomain: React.PropTypes.string,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = PasswordLogin;
|
module.exports = PasswordLogin;
|
||||||
|
|
Loading…
Reference in a new issue