mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-22 17:02:01 +00:00
- Updated `next.config.ts` to include remote image patterns for user verification. - Introduced `VerifyUserDetails` function in `lib/person.ts` to validate user data against national records. - Added `usePerson` hook for fetching national data based on ID card. - Enhanced `signup` and `signin` functions in `auth-actions.ts` to handle user verification status and send notifications for pending verifications. - Refactored `VerifyUser` function in `user-actions.ts` to incorporate national data validation. - Improved UI components in the user verification page to display both database and national information. - Updated `InputReadOnly` component to support customizable label classes for better styling. These changes improve the user verification process, ensuring data integrity and enhancing the overall user experience.
22 lines
635 B
TypeScript
22 lines
635 B
TypeScript
"use server";
|
|
import usePerson from "@/hooks/use-person";
|
|
import type { User } from "@prisma/client";
|
|
|
|
export default async function VerifyUserDetails({ user }: { user: User }) {
|
|
const phoneNumber = user.phoneNumber.slice(4);
|
|
const nationalData = await usePerson({ idCard: user.id_card ?? "" });
|
|
const dob = new Date(nationalData.dob);
|
|
const age = new Date().getFullYear() - dob.getFullYear();
|
|
|
|
if (
|
|
user.id_card === nationalData.nic &&
|
|
user.name === nationalData.name_en &&
|
|
user.address === nationalData.house_name_en &&
|
|
phoneNumber === nationalData.primary_contact &&
|
|
age >= 18
|
|
) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|