Give our input fields names

Otherwise browsers' 'Remember Password' feature has to guess
badly and ends up putting the login username / password in the
first two password reset fields which is a bit odd.
This commit is contained in:
David Baker 2016-10-14 15:34:44 +01:00
parent 920f498925
commit 3f067cbdf6
2 changed files with 5 additions and 0 deletions

View file

@ -162,16 +162,19 @@ module.exports = React.createClass({
<div> <div>
<form onSubmit={this.onSubmitForm}> <form onSubmit={this.onSubmitForm}>
<input className="mx_Login_field" ref="user" type="text" <input className="mx_Login_field" ref="user" type="text"
name="reset_email" // define a name so browser's password autofill gets less confused
value={this.state.email} value={this.state.email}
onChange={this.onInputChanged.bind(this, "email")} onChange={this.onInputChanged.bind(this, "email")}
placeholder="Email address" autoFocus /> placeholder="Email address" autoFocus />
<br /> <br />
<input className="mx_Login_field" ref="pass" type="password" <input className="mx_Login_field" ref="pass" type="password"
name="reset_password"
value={this.state.password} value={this.state.password}
onChange={this.onInputChanged.bind(this, "password")} onChange={this.onInputChanged.bind(this, "password")}
placeholder="New password" /> placeholder="New password" />
<br /> <br />
<input className="mx_Login_field" ref="pass" type="password" <input className="mx_Login_field" ref="pass" type="password"
name="reset_password_confirm"
value={this.state.password2} value={this.state.password2}
onChange={this.onInputChanged.bind(this, "password2")} onChange={this.onInputChanged.bind(this, "password2")}
placeholder="Confirm your new password" /> placeholder="Confirm your new password" />

View file

@ -96,10 +96,12 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
<div> <div>
<form onSubmit={this.onSubmitForm}> <form onSubmit={this.onSubmitForm}>
<input className="mx_Login_field" type="text" <input className="mx_Login_field" type="text"
name="username" // make it a little easier for browser's remember-password
value={this.state.username} onChange={this.onUsernameChanged} value={this.state.username} onChange={this.onUsernameChanged}
placeholder="Email or user name" autoFocus /> placeholder="Email or user name" autoFocus />
<br /> <br />
<input className={pwFieldClass} ref={(e) => {this._passwordField = e;}} type="password" <input className={pwFieldClass} ref={(e) => {this._passwordField = e;}} type="password"
name="password"
value={this.state.password} onChange={this.onPasswordChanged} value={this.state.password} onChange={this.onPasswordChanged}
placeholder="Password" /> placeholder="Password" />
<br /> <br />