mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-01 21:28:23 +00:00
feat: add age validation in signup and update payment verification logic
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m17s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m17s
This commit is contained in:
@ -121,6 +121,15 @@ export async function signup(_actionState: ActionState, formData: FormData) {
|
||||
errors: parsedData.error.flatten(),
|
||||
};
|
||||
}
|
||||
const age =
|
||||
new Date().getFullYear() - new Date(parsedData.data.dob).getFullYear();
|
||||
if (age < 18) {
|
||||
return {
|
||||
message: "You must be at least 18 years old to register.",
|
||||
payload: formData,
|
||||
db_error: "dob",
|
||||
};
|
||||
}
|
||||
|
||||
const idCardExists = await checkIdOrPhone({
|
||||
id_card: parsedData.data.id_card,
|
||||
|
Reference in New Issue
Block a user