From fa8698843645e0ae47d290ebc3f6ffbb47bd2559 Mon Sep 17 00:00:00 2001 From: Trial Date: Sat, 29 Mar 2025 13:02:12 +0300 Subject: [PATCH] added fix on fe side --- src/Features/Auth/authSlice.js | 6 ++++-- src/Validation/validation.js | 7 ------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Features/Auth/authSlice.js b/src/Features/Auth/authSlice.js index 2fde49202..2fe089971 100644 --- a/src/Features/Auth/authSlice.js +++ b/src/Features/Auth/authSlice.js @@ -12,7 +12,8 @@ const initialState = { export const register = createAsyncThunk("auth/register", async (form, thunkApi) => { try { - const res = await networkService.registerUser(form); + const newForm = {...form, email: form.email.toLowerCase()} + const res = await networkService.registerUser(newForm); return res.data; } catch (error) { if (error.response.data) { @@ -28,7 +29,8 @@ export const register = createAsyncThunk("auth/register", async (form, thunkApi) export const login = createAsyncThunk("auth/login", async (form, thunkApi) => { try { - const res = await networkService.loginUser(form); + const newForm = {...form, email: form.email.toLowerCase()} + const res = await networkService.loginUser(newForm); return res.data; } catch (error) { if (error.response && error.response.data) { diff --git a/src/Validation/validation.js b/src/Validation/validation.js index 6e8ff76cb..48b57d046 100644 --- a/src/Validation/validation.js +++ b/src/Validation/validation.js @@ -65,13 +65,6 @@ const credentials = joi.object({ .string() .trim() .email({ tlds: { allow: false } }) - .custom((value, helpers) => { - const lowercasedValue = value.toLowerCase(); - if (value !== lowercasedValue) { - return helpers.message("Email must be in lowercase"); - } - return lowercasedValue; - }) .messages({ "string.empty": "Email is required", "string.email": "Must be a valid email address",