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

This commit is contained in:
2025-04-20 12:36:24 +05:00
parent f7122cb252
commit 0c093f1303
5 changed files with 31 additions and 193 deletions

View File

@ -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,