feat: refactored login

This commit is contained in:
Sebastian Hierholzer
2023-12-03 21:01:28 +01:00
parent 93e4897c0b
commit 361795ed47
7 changed files with 1624 additions and 260 deletions
+6 -1
View File
@@ -31,13 +31,18 @@ export default async function verifyUser({
subscriptions: true,
},
});
const ssoUser = await prisma.account.findFirst({
where: {
userId: userId,
},
});
if (!user) {
res.status(404).json({ response: "User not found." });
return null;
}
if (!user.username) {
if (!user.username && !ssoUser) { // SSO users don't need a username
res.status(401).json({
response: "Username not found.",
});