Prevent default for forgot password link

The forgot password link should prevent default to avoid changing the URL's hash
state.
This commit is contained in:
J. Ryan Stinnett 2019-02-20 16:00:13 +00:00
parent d220dd49ef
commit 42bb3c4f40

View File

@ -58,6 +58,7 @@ class PasswordLogin extends React.Component {
loginType: PasswordLogin.LOGIN_FIELD_MXID,
};
this.onForgotPasswordClick = this.onForgotPasswordClick.bind(this);
this.onSubmitForm = this.onSubmitForm.bind(this);
this.onUsernameChanged = this.onUsernameChanged.bind(this);
this.onUsernameBlur = this.onUsernameBlur.bind(this);
@ -74,6 +75,12 @@ class PasswordLogin extends React.Component {
this._loginField = null;
}
onForgotPasswordClick(ev) {
ev.preventDefault();
ev.stopPropagation();
this.props.onForgotPasswordClick();
}
onSubmitForm(ev) {
ev.preventDefault();
@ -244,7 +251,7 @@ class PasswordLogin extends React.Component {
forgotPasswordJsx = <span>
{_t('Not sure of your password? <a>Set a new one</a>', {}, {
a: sub => <a className="mx_Login_forgot"
onClick={this.props.onForgotPasswordClick}
onClick={this.onForgotPasswordClick}
href="#"
>
{sub}