Fixed a problem where users were being redirected to the dashboard

This commit is contained in:
Tiago Ribeiro
2024-11-25 10:33:37 +00:00
parent 55a03b283f
commit 47762544fc

View File

@@ -27,8 +27,7 @@ export const getServerSideProps = withIronSessionSsr(async ({ req, res, query })
const loginDestination = Buffer.from(req.url || "/").toString("base64") const loginDestination = Buffer.from(req.url || "/").toString("base64")
if (!user) return redirect(`/login?destination=${loginDestination}`) if (!user) return redirect(`/login?destination=${loginDestination}`)
if (shouldRedirectHome(user) || checkAccess(user, ["corporate", "mastercorporate"])) if (shouldRedirectHome(user)) return redirect("/")
return redirect("/")
const { assignment: assignmentID, destination } = query as { assignment?: string, destination?: string } const { assignment: assignmentID, destination } = query as { assignment?: string, destination?: string }
const destinationURL = !!destination ? Buffer.from(destination, 'base64').toString() : undefined const destinationURL = !!destination ? Buffer.from(destination, 'base64').toString() : undefined