Skip to content

Scheduling infrastructure for absolutely everyone.

Improve check user exists (#25057)

Volnei Munhoz53a931da4e51
diff --git a/apps/web/server/lib/auth/login/getServerSideProps.tsx b/apps/web/server/lib/auth/login/getServerSideProps.tsx
index ad8914e718b..671cb0cb961 100644
--- a/apps/web/server/lib/auth/login/getServerSideProps.tsx
+++ b/apps/web/server/lib/auth/login/getServerSideProps.tsx
@@ -39,7 +39,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
},
};
}
- } catch (e) {
+ } catch {
return {
redirect: {
destination: "/auth/error?error=Invalid%20JWT%3A%20Please%20try%20again",
@@ -76,8 +76,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
};
}
- const userCount = await prisma.user.count();
- if (userCount === 0) {
+ const userExists = await prisma.user.findFirst({ select: { id: true } });
+ if (!userExists) {
// Proceed to new onboarding to create first admin user
return {
redirect: {