[URGENT] Hotfix: re-adds the password and username set check in signup (#8638)
* Check for existing password and username to ensure it isn't an invite * added check with verified to allow SAML linking * wrong verified check lol * updated comment * unintended
This commit is contained in:
parent
99f736b317
commit
e78fb22451
@ -36,14 +36,25 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is actually an existingUser if username matches
|
// There is an existingUser if the username matches
|
||||||
// OR if email matches and both username and password are set
|
// OR if the email matches AND either the email is verified
|
||||||
|
// or both username and password are set
|
||||||
const existingUser = await prisma.user.findFirst({
|
const existingUser = await prisma.user.findFirst({
|
||||||
where: {
|
where: {
|
||||||
OR: [
|
OR: [
|
||||||
{ username },
|
{ username },
|
||||||
{
|
{
|
||||||
AND: [{ email: userEmail }],
|
AND: [
|
||||||
|
{ email: userEmail },
|
||||||
|
{
|
||||||
|
OR: [
|
||||||
|
{ emailVerified: { not: null } },
|
||||||
|
{
|
||||||
|
AND: [{ password: { not: null } }, { username: { not: null } }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user