fix: org username check for dynamic and signup (#11390)

This commit is contained in:
Leo Giovanetti authored and GitHub committed 2023-09-15 13:06:56 -03:00
1 parent 7beb9568ba
commit 7154349e9e
3 files changed
+12 -4

No files matched your search

+3 -1
View File
@@ -9,7 +9,9 @@ export const validateUsername = async (username: string, email: string, organiza
where: {
...(organizationId ? { organizationId } : {}),
OR: [
{ username },
// When inviting to org, invited user gets created with username now, so in an org context we
// can't check for username as it will exist on signup
...(!organizationId ? [{ username }] : [{}]),
{
AND: [
{ email },