Skip to content

Commit

Permalink
fix(signup): trim email
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiaMontazeri committed Nov 29, 2023
1 parent 93a9d06 commit 06a55ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/pages/Signup/Signup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const SignUpForm = ({ onLoginClick }) => {
phone_number: phoneNumber,
account: {
password,
email,
email: email.trim(),
},
};
createUser(data);
Expand Down Expand Up @@ -254,7 +254,7 @@ const LoginForm = ({ onSignUpClick }) => {
if (isFormValid) {
const data = {
password: password,
email: email,
email: email.trim(),
};

issueToken(data);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/utils/Email.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export const hasEmailError = (email) => {
return false;
}

const result = String(email)
const trimmedEmail = String(email).trim();

const result = trimmedEmail
.toLowerCase()
.match(
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
Expand Down

0 comments on commit 06a55ab

Please sign in to comment.