From a05dc773747b1378343117abb9aaffdcbccbb66e 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 9e7a6ed7b..6a34419a3 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.replace(' ', ''); // 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 e7d641786..a7250193b 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.replace(' ', ''); // 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 9dcf1ebf8..f5c96b9c1 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.replace(' ', ''); // E-mail adresses cannot have spaces this.setState(() => ({ email })); };