mirror of
https://github.com/dokploy/dokploy.git
synced 2026-06-14 03:19:49 +00:00
Merge pull request #4335 from Dokploy/fix/auth-redirect-permanent-cache
fix: use temporary redirects for auth checks in getServerSideProps
This commit is contained in:
@@ -84,7 +84,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -104,7 +104,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1827,7 +1827,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -455,7 +455,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -336,7 +336,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -340,7 +340,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -318,7 +318,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -324,7 +324,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -329,7 +329,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -26,7 +26,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -43,7 +43,7 @@ export async function getServerSideProps(
|
||||
if (!user || (user.role !== "owner" && user.role !== "admin")) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: { destination: "/", permanent: true },
|
||||
redirect: { destination: "/", permanent: false },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function getServerSideProps(
|
||||
if (!IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -33,7 +33,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role !== "owner") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -36,7 +36,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -53,7 +53,7 @@ export async function getServerSideProps(
|
||||
if (!userPermissions?.gitProviders.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function getServerSideProps(
|
||||
if (!IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -33,7 +33,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role !== "owner") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -46,7 +46,7 @@ export async function getServerSideProps(
|
||||
if (user.role !== "owner") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/settings/profile",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function getServerSideProps(
|
||||
if (!user || user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -53,7 +53,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -61,7 +61,7 @@ export async function getServerSideProps(
|
||||
if (user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/settings/profile",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -36,7 +36,7 @@ export async function getServerSideProps(
|
||||
if (user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/settings/profile",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -54,7 +54,7 @@ export async function getServerSideProps(
|
||||
if (!userPermissions?.sshKeys.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -54,7 +54,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (user.role === "member") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/settings/profile",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function getServerSideProps(
|
||||
if (!userPermissions?.tag.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -66,7 +66,7 @@ export async function getServerSideProps(
|
||||
if (!userPermissions?.member.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -54,7 +54,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (user.role !== "owner") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/settings/profile",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -54,7 +54,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -80,7 +80,7 @@ export async function getServerSideProps(
|
||||
if (!userPermissions?.docker.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function getServerSideProps(
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -32,7 +32,7 @@ export async function getServerSideProps(
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -58,7 +58,7 @@ export async function getServerSideProps(
|
||||
if (!userPermissions?.traefikFiles.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -407,7 +407,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
@@ -425,7 +425,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (!hasAdmin) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/register",
|
||||
},
|
||||
};
|
||||
@@ -436,7 +436,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -333,7 +333,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
// if (IS_CLOUD) {
|
||||
// return {
|
||||
// redirect: {
|
||||
// permanent: true,
|
||||
// permanent: false,
|
||||
// destination: "/",
|
||||
// },
|
||||
// };
|
||||
@@ -342,7 +342,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (typeof token !== "string") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -365,7 +365,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
if (invitation.isExpired) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -382,7 +382,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
||||
console.log("error", error);
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -302,7 +302,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/dashboard/home",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -190,7 +190,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (!IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -200,7 +200,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (typeof token !== "string") {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -168,7 +168,7 @@ export async function getServerSideProps(_context: GetServerSidePropsContext) {
|
||||
if (!IS_CLOUD) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
@@ -103,7 +103,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
if (!userPermissions?.api.read) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
permanent: false,
|
||||
destination: "/",
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user