nric validation
This commit is contained in:
@@ -40,6 +40,11 @@ export default function SignupView({
|
|||||||
toast.error("All fields are required.");
|
toast.error("All fields are required.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const nricRegex = /^[A-Za-z][0-9]{7}[A-Za-z]$/;
|
||||||
|
if (!nricRegex.test(nric)) {
|
||||||
|
toast.error("Please enter a valid NRIC.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (password !== confirmPassword) {
|
if (password !== confirmPassword) {
|
||||||
toast.error("Passwords do not match.");
|
toast.error("Passwords do not match.");
|
||||||
return false;
|
return false;
|
||||||
@@ -61,8 +66,8 @@ export default function SignupView({
|
|||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
gender: Number(gender),
|
gender: Number(gender),
|
||||||
nationalRegistrationIdentityCardNumber: nric,
|
nationalRegistrationIdentityCardNumber: nric.toUpperCase(),
|
||||||
email: emailValue,
|
email: emailValue.toLowerCase(),
|
||||||
password,
|
password,
|
||||||
dateOfBirth: new Date(dateOfBirth),
|
dateOfBirth: new Date(dateOfBirth),
|
||||||
resumeName: "",
|
resumeName: "",
|
||||||
|
|||||||
Reference in New Issue
Block a user