Made sure the user can’t navigate to another page when they shouldn’t via the URL
This commit is contained in:
@@ -11,6 +11,7 @@ import {Tab} from "@headlessui/react";
|
||||
import clsx from "clsx";
|
||||
import Lists from "./(admin)/Lists";
|
||||
import BatchCodeGenerator from "./(admin)/BatchCodeGenerator";
|
||||
import {shouldRedirectHome} from "@/utils/navigation.disabled";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
const user = req.session.user;
|
||||
@@ -26,7 +27,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
};
|
||||
}
|
||||
|
||||
if (user.type !== "developer") {
|
||||
if (shouldRedirectHome(user) || user.type !== "developer") {
|
||||
res.setHeader("location", "/");
|
||||
res.statusCode = 302;
|
||||
res.end();
|
||||
|
||||
Reference in New Issue
Block a user