Skip to content

Commit

Permalink
No registration allowed for non-admins
Browse files Browse the repository at this point in the history
  • Loading branch information
joywin2003 committed Nov 19, 2024
1 parent cef2853 commit 1af1c81
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/common/cta-section-2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function FullScreenCTA() {
size="lg"
className="bg-red-600 hover:bg-red-700 text-white py-6 px-4 text-xl transition-all duration-300 transform hover:scale-105 mt-8"
>
Register Now
Registrations Open Soon
</Button>
</Link>
{/* <p className="text-sm text-gray-400">
Expand Down
2 changes: 1 addition & 1 deletion src/components/widget/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const Nav = () => {
size="lg"
className="bg-red-600 hover:bg-red-700 text-white py-4 "
>
Register Now
Registrations Open Soon
{/* <ArrowRight className="ml-2" /> */}
</Button>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/widget/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default function HeroHighlight() {
size="lg"
className="bg-red-600 hover:bg-red-700 text-white py-2 transition-all duration-300 transform hover:scale-105"
>
Register Now
Registrations Open Soon
</Button>
</Link>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export async function middleware(request: NextRequest) {
return NextResponse.redirect(new URL("/", request.url));
}
}
if (url.pathname.startsWith("/register")) {
if (token?.role !== "ADMIN") {
return NextResponse.redirect(new URL("/", request.url));
}
}

}

// See "Matching Paths" below to learn more
Expand Down

0 comments on commit 1af1c81

Please sign in to comment.