Skip to content

Commit 53a931d

Browse files
authored
Improve check user exists (calcom#25057)
1 parent 228fbaf commit 53a931d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/web/server/lib/auth/login/getServerSideProps.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
3939
},
4040
};
4141
}
42-
} catch (e) {
42+
} catch {
4343
return {
4444
redirect: {
4545
destination: "/auth/error?error=Invalid%20JWT%3A%20Please%20try%20again",
@@ -76,8 +76,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
7676
};
7777
}
7878

79-
const userCount = await prisma.user.count();
80-
if (userCount === 0) {
79+
const userExists = await prisma.user.findFirst({ select: { id: true } });
80+
if (!userExists) {
8181
// Proceed to new onboarding to create first admin user
8282
return {
8383
redirect: {

0 commit comments

Comments
 (0)