From cfe708a27968240c869ad514861f54ee25965edd Mon Sep 17 00:00:00 2001 From: "le_hooligan\\Yvng Alan" Date: Mon, 20 Nov 2023 13:44:13 -0500 Subject: [PATCH] Fixed messages --- frontend/src/common/redux/userLogin.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/common/redux/userLogin.ts b/frontend/src/common/redux/userLogin.ts index b1a4d80b..e6badc60 100644 --- a/frontend/src/common/redux/userLogin.ts +++ b/frontend/src/common/redux/userLogin.ts @@ -240,18 +240,30 @@ export const registerViaEmailAndPassword = createAsyncThunk< }); } - if (!firstName || firstName === "" || !isNameValid(firstName)) { + if (!firstName || firstName === "") { return thunkAPI.rejectWithValue({ message: "Please enter your first name" }); } - if (!lastName || lastName === "" || !isNameValid(lastName)) { + if (!isNameValid(firstName)) { + return thunkAPI.rejectWithValue({ + message: "First name must contain only letters" + }); + } + + if (!lastName || lastName === "") { return thunkAPI.rejectWithValue({ message: "Please enter your last name" }); } + if (!isNameValid(lastName)) { + return thunkAPI.rejectWithValue({ + message: "Last name must contain only letters" + }); + } + try { const userCredential = await createUserWithEmailAndPassword( auth,