From 93fbdb78e2efd1c3bf394371d93e59b75d17a370 Mon Sep 17 00:00:00 2001 From: davidmurray Date: Thu, 21 Sep 2023 17:03:06 -0400 Subject: [PATCH] auth: remove trailing space in email or username on login and register forms Fixes #720 --- .../src/components/forms/auth/localLogin/LoginForm.tsx | 2 +- .../src/components/forms/auth/localLogin/RegisterForm.tsx | 2 +- .../src/components/forms/auth/passwordless/PwdLessLoginForm.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/LoginForm.tsx b/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/LoginForm.tsx index 9e7a6ed7..a4c12592 100644 --- a/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/LoginForm.tsx +++ b/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/LoginForm.tsx @@ -64,7 +64,7 @@ export class LoginPage extends React.Component) => { - const usernameOrEmail = e.target.value; + const usernameOrEmail = e.target.value.replaceAll(' ', ''); // E-mails and usernames can't have spaces this.setState(() => ({ usernameOrEmail })); }; diff --git a/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/RegisterForm.tsx b/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/RegisterForm.tsx index e7d64178..6aa61857 100644 --- a/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/RegisterForm.tsx +++ b/packages/chaire-lib-frontend/src/components/forms/auth/localLogin/RegisterForm.tsx @@ -104,7 +104,7 @@ export class RegisterForm extends React.Component): void => { - const usernameOrEmail = e.target.value; + const usernameOrEmail = e.target.value.replaceAll(' ', ''); // E-mails and usernames can't have spaces if (usernameOrEmail) { this.setState(() => ({ email: usernameOrEmail })); } // allow empty string diff --git a/packages/chaire-lib-frontend/src/components/forms/auth/passwordless/PwdLessLoginForm.tsx b/packages/chaire-lib-frontend/src/components/forms/auth/passwordless/PwdLessLoginForm.tsx index 9dcf1ebf..eac73529 100644 --- a/packages/chaire-lib-frontend/src/components/forms/auth/passwordless/PwdLessLoginForm.tsx +++ b/packages/chaire-lib-frontend/src/components/forms/auth/passwordless/PwdLessLoginForm.tsx @@ -64,7 +64,7 @@ export class LoginPage extends React.Component) => { - const email = e.target.value; + const email = e.target.value.replaceAll(' ', ''); // E-mail adresses cannot have spaces this.setState(() => ({ email })); };