Merge pull request #2803 from Budibase/fix/provisioning-only-check-verified

Update existing user in account portal check to only check verified users - fix provision flow
This commit is contained in:
Rory Powell 2021-09-29 17:58:12 +01:00 committed by GitHub
commit b47003f359
1 changed files with 4 additions and 4 deletions

View File

@ -53,22 +53,22 @@ async function saveUser(
// check budibase users inside the tenant // check budibase users inside the tenant
dbUser = await getGlobalUserByEmail(email) dbUser = await getGlobalUserByEmail(email)
if (dbUser != null && (dbUser._id !== _id || Array.isArray(dbUser))) { if (dbUser != null && (dbUser._id !== _id || Array.isArray(dbUser))) {
throw "Email address already in use." throw `Email address ${email} already in use.`
} }
// check budibase users in other tenants // check budibase users in other tenants
if (env.MULTI_TENANCY) { if (env.MULTI_TENANCY) {
dbUser = await getTenantUser(email) dbUser = await getTenantUser(email)
if (dbUser != null) { if (dbUser != null) {
throw "Email address already in use." throw `Email address ${email} already in use.`
} }
} }
// check root account users in account portal // check root account users in account portal
if (!env.SELF_HOSTED) { if (!env.SELF_HOSTED) {
const account = await accounts.getAccount(email) const account = await accounts.getAccount(email)
if (account) { if (account && account.verified) {
throw "Email address already in use." throw `Email address ${email} already in use.`
} }
} }
} else { } else {