Fix signup query (#1608)
* Remove emailVerified not null from query * Improve query to find existing user * Add test suite to Signup from a Team Invite * Allow importing modules with aliases * Delete created data after all tests * Resolve conflicts * Use teampro instead of pro user and refactor code
This commit is contained in:
1 parent
cad77ad237
commit
73de0c2185
9 files changed
+140
-16
No files matched your search
@@ -31,21 +31,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
return;
|
||||
}
|
||||
|
||||
// There is actually an existingUser if username matches
|
||||
// OR if email matches and both username and password are set
|
||||
const existingUser = await prisma.user.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
{ username },
|
||||
{
|
||||
username: username,
|
||||
},
|
||||
{
|
||||
email: userEmail,
|
||||
},
|
||||
],
|
||||
AND: [
|
||||
{
|
||||
emailVerified: {
|
||||
not: null,
|
||||
},
|
||||
AND: [{ email: userEmail }, { password: { not: null } }, { username: { not: null } }],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user