minor change

This commit is contained in:
daniel31x13 2024-08-19 19:30:01 -04:00
parent 495509c888
commit 078e5ba95f

View File

@ -1179,14 +1179,14 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
}, },
callbacks: { callbacks: {
async signIn({ user, account, profile, email, credentials }) { async signIn({ user, account, profile, email, credentials }) {
if (account?.provider !== "credentials" && newSsoUsersDisabled) { if (account?.provider !== "credentials") {
// registration via SSO can be separately disabled // registration via SSO can be separately disabled
const existingUser = await prisma.account.findFirst({ const existingUser = await prisma.account.findFirst({
where: { where: {
providerAccountId: account?.providerAccountId, providerAccountId: account?.providerAccountId,
}, },
}); });
if (!existingUser) { if (!existingUser && newSsoUsersDisabled) {
return false; return false;
} }
} }