Skip to content

Commit

Permalink
auth: remove trailing space in email or username on login and registe…
Browse files Browse the repository at this point in the history
…r forms

Fixes #720
  • Loading branch information
davidmurray committed Sep 22, 2023
1 parent 4dffddf commit a05dc77
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class LoginPage extends React.Component<LoginPageProps & WithTranslation,
};

onUsernameOrEmailChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const usernameOrEmail = e.target.value;
const usernameOrEmail = e.target.value.replace(' ', ''); // E-mails and usernames can't have spaces
this.setState(() => ({ usernameOrEmail }));
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class RegisterForm extends React.Component<RegisterFormProps & WithTransl
};

onEmailChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
const usernameOrEmail = e.target.value;
const usernameOrEmail = e.target.value.replace(' ', ''); // E-mails and usernames can't have spaces
if (usernameOrEmail) {
this.setState(() => ({ email: usernameOrEmail }));
} // allow empty string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class LoginPage extends React.Component<LoginPageProps & WithTranslation,
};

onEmailChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const email = e.target.value;
const email = e.target.value.replace(' ', ''); // E-mail adresses cannot have spaces
this.setState(() => ({ email }));
};

Expand Down

0 comments on commit a05dc77

Please sign in to comment.