Normalize email when inviting memebers and logging in.

This commit is contained in:
Killian
2023-08-15 15:57:27 +01:00
parent 11bb0d648f
commit cb42db3de4
2 changed files with 5 additions and 3 deletions
@@ -45,13 +45,15 @@ export const InitialStep = ({
return; return;
} }
const sanitizedEmail = email.toLowerCase();
setIsLoading(true); setIsLoading(true);
if (queryParams && queryParams.get("callback_port")) { if (queryParams && queryParams.get("callback_port")) {
const callbackPort = queryParams.get("callback_port") const callbackPort = queryParams.get("callback_port")
// attemptCliLogin // attemptCliLogin
const isCliLoginSuccessful = await attemptCliLogin({ const isCliLoginSuccessful = await attemptCliLogin({
email, email: sanitizedEmail,
password, password,
}) })
@@ -78,7 +80,7 @@ export const InitialStep = ({
} }
} else { } else {
const isLoginSuccessful = await attemptLogin({ const isLoginSuccessful = await attemptLogin({
email, email: sanitizedEmail,
password, password,
}); });
if (isLoginSuccessful && isLoginSuccessful.success) { if (isLoginSuccessful && isLoginSuccessful.success) {
@@ -60,7 +60,7 @@ type Props = {
}; };
const addMemberFormSchema = yup.object({ const addMemberFormSchema = yup.object({
email: yup.string().email().required().label("Email").trim() email: yup.string().email().required().label("Email").trim().lowercase()
}); });
type TAddMemberForm = yup.InferType<typeof addMemberFormSchema>; type TAddMemberForm = yup.InferType<typeof addMemberFormSchema>;