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,