Implemented email verification
This commit is contained in:
@@ -17,15 +17,12 @@ interface AppRouteHandlerFnContext {
|
||||
params?: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
export const middleware = (
|
||||
request: NextRequest,
|
||||
event: AppRouteHandlerFnContext): NextResponse | null => {
|
||||
export const middleware = (request: NextRequest, event: AppRouteHandlerFnContext): NextResponse | null => {
|
||||
return NextAuth(authConfig).auth((request): any => {
|
||||
const { nextUrl }: { nextUrl: NextURL } = request
|
||||
const isLoggedIn: boolean = !!request.auth
|
||||
const isApiAuthRoute: boolean = nextUrl.pathname.startsWith(apiAuthPrefix)
|
||||
const isPublicRoute: boolean = testPathnameRegex(publicRoutes,
|
||||
nextUrl.pathname)
|
||||
const isPublicRoute: boolean = testPathnameRegex(publicRoutes, nextUrl.pathname)
|
||||
const isAuthRoute: boolean = testPathnameRegex(authRoutes, nextUrl.pathname)
|
||||
|
||||
if (isApiAuthRoute) {
|
||||
@@ -54,7 +51,6 @@ export const middleware = (
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
'/((?!.+\\.[\\w]+$|_next).*)',
|
||||
'/(api|static|trpc)(.*)'],
|
||||
'/((?!.+\\.[\\w]+$|_next).*)', '/(api|static|trpc)(.*)'],
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user