Skip to content

Commit

Permalink
Fix anyone can access /profile-picture-check and /role (#169)
Browse files Browse the repository at this point in the history
* Fix anyone can access /profile-picture-check and /role

* fix typo

* prettier -w

---------

Co-authored-by: mozsarmate <[email protected]>
  • Loading branch information
EasySouls and mozsarmate authored Feb 22, 2025
1 parent 75d141b commit 6a1e3c5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/frontend/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export function middleware(request: NextRequest) {
}
}

if (request.nextUrl.pathname.startsWith('/periods')) {
if (
request.nextUrl.pathname.startsWith('/periods') ||
request.nextUrl.pathname.startsWith('/roles') ||
request.nextUrl.pathname.startsWith('/profile-picture-check')
) {
if (role === 'BODY_MEMBER' || role === 'BODY_ADMIN' || role === 'SUPERUSER') {
return NextResponse.next();
}
Expand All @@ -27,5 +31,13 @@ export function middleware(request: NextRequest) {
return NextResponse.next();
}
export const config = {
matcher: ['/profile', '/application-form', '/periods', '/applications', '/periods/:path*'],
matcher: [
'/profile',
'/application-form',
'/periods',
'/applications',
'/periods/:path*',
'/profile-picture-check',
'/roles',
],
};

0 comments on commit 6a1e3c5

Please sign in to comment.