Skip to content

Commit eb16a68

Browse files
mtmarco87dziraf
authored andcommitted
fix: allow routes outside /admin when using authenticated router
1 parent be49cb7 commit eb16a68

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/authentication/protected-routes.handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ export const withProtectedRoutesHandler = (
88
const { rootPath } = admin.options;
99

1010
fastifyApp.addHook('preHandler', async (request, reply) => {
11-
if (AdminRouter.assets.find(asset => request.url.match(asset.path))) {
11+
if (AdminRouter.assets.find((asset) => request.url.match(asset.path))) {
1212
return;
1313
} else if (
14+
!request.url.startsWith(rootPath) ||
1415
request.session.adminUser ||
1516
// these routes doesn't need authentication
1617
request.url.startsWith(admin.options.loginPath) ||

0 commit comments

Comments
 (0)