+
+
+ {
+ setemail(e?.target?.value);
+ }}
+ />
+
+
+
+
-
+
+
+
diff --git a/src/components/loginForms/loginWithEmail.tsx b/src/components/loginForms/loginWithEmail.tsx
new file mode 100644
index 00000000..55842182
--- /dev/null
+++ b/src/components/loginForms/loginWithEmail.tsx
@@ -0,0 +1,37 @@
+import React from "react";
+import { url } from "../../helpers/api";
+import LockImg from "@/../public/icons/lock.svg";
+import toast from "react-hot-toast";
+
+export const LoginWithEmail = (params: { email: String }) => {
+ const onClick = async () => {
+ const res = await fetch(url("/auth/passwordless"), {
+ method: "POST",
+ cache: "no-store",
+ headers: {
+ "Content-type": "application/json",
+ },
+ body: JSON.stringify({ email: params.email }),
+ });
+ console.log(res);
+ const resOk = res.ok;
+ if (resOk) toast.success("Email Has Been Sent");
+ return resOk;
+ };
+
+ return (
+ <>
+
+
+
+ >
+ );
+};
diff --git a/src/helpers/googleAuth.ts b/src/helpers/googleAuth.ts
new file mode 100644
index 00000000..648b0bce
--- /dev/null
+++ b/src/helpers/googleAuth.ts
@@ -0,0 +1,11 @@
+const baseUrl = process.env.NEXT_PUBLIC_BACKEND_URL;
+process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
+
+export const url = (NextUrl: string) => {
+ return `${baseUrl}/api/v1${NextUrl}`;
+};
+
+export const googleLoginURL = () => {
+ const googleLoginURL = url("/auth/google/login");
+ return googleLoginURL;
+};
diff --git a/src/middleware.ts b/src/middleware.ts
index 2bf3e388..b32cb0e8 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -2,20 +2,37 @@ import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
const adminRoutes = ["/admin/company", "/admin/students", "/admin/job"];
-const studentRoutes = ['/student/jobs', '/student/offCampus', '/student/onCampus', '/student/interviewExperiences', '/student/profile', '/student/resumes'];
-const recruiterRoutes = ['/recruiter/jaf', '/recruiter/prevjaf'];
+const studentRoutes = [
+ "/student/jobs",
+ "/student/offCampus",
+ "/student/onCampus",
+ "/student/interviewExperiences",
+ "/student/profile",
+ "/student/resumes",
+];
+const recruiterRoutes = ["/recruiter/jaf", "/recruiter/prevjaf"];
export function middleware(request: NextRequest) {
const userCookie = request.cookies.get("user");
- const user = userCookie ? JSON.parse(userCookie.value) : null;;
-
- if (user?.role !== "ADMIN" && adminRoutes.includes(request.nextUrl.pathname) ) {
+ const user = userCookie ? JSON.parse(userCookie.value) : null;
+
+ if (
+ user?.role !== "ADMIN" &&
+ adminRoutes.includes(request.nextUrl.pathname)
+ ) {
return NextResponse.redirect(new URL("/login", request.url));
}
- if (user?.role !== "STUDENT" && studentRoutes.includes(request.nextUrl.pathname) ) {
+ if (
+ user?.role !== "STUDENT" &&
+ studentRoutes.includes(request.nextUrl.pathname)
+ ) {
return NextResponse.redirect(new URL("/login", request.url));
}
- if (user?.role !== "RECRUITER" && recruiterRoutes.includes(request.nextUrl.pathname) && request.url.includes("/recruiter") ) {
+ if (
+ user?.role !== "RECRUITER" &&
+ recruiterRoutes.includes(request.nextUrl.pathname) &&
+ request.url.includes("/recruiter")
+ ) {
return NextResponse.redirect(new URL("/login", request.url));
}