Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: transform email to lower case before being passed in auth & che… #1475

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/src/components/auth/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const Auth = () => {
const isEmailValid = validateEmail();

if (isEmailValid) {
const userData = await checkUser(email, LOG_IN);
const lowercaseEmail = email.toLowerCase();
const userData = await checkUser(lowercaseEmail, LOG_IN);
if (userData) {
if (
userData.user.accessLevel !== ADMIN &&
Expand All @@ -59,7 +60,7 @@ const Auth = () => {
return;
}

const isAuth = await checkAuth(email, LOG_IN);
const isAuth = await checkAuth(lowercaseEmail, LOG_IN);
if (isAuth) {
history.push('/emailsent');
} else {
Expand Down
6 changes: 3 additions & 3 deletions client/src/pages/CheckInForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const CheckInForm = (props) => {

const submitNewProfile = (userForm) => {
// First, create a new user in the user collection

userForm.email = userForm.email.toLowerCase();
fetch('/api/users', {
method: 'POST',
body: JSON.stringify(userForm),
Expand Down Expand Up @@ -322,7 +322,7 @@ const CheckInForm = (props) => {
}
// SUBMIT all of the user's info from the userForm object
if (ready) {
submitForm(userForm);
submitForm({ ...userForm, email: userForm.email.toLowerCase() });
}

setIsLoading(false);
Expand Down Expand Up @@ -412,7 +412,7 @@ const CheckInForm = (props) => {
'Content-Type': 'application/json',
'x-customrequired-header': headerToSend,
},
body: JSON.stringify({ email: formInput.email }),
body: JSON.stringify({ email: formInput.email.toLowerCase() }),
})
.then((res) => {
if (res.ok) {
Expand Down
Loading