Fix saveUser by adding same tenant check
This commit is contained in:
parent
36daa9fc6a
commit
4ee2d23749
|
@ -59,7 +59,7 @@ async function saveUser(
|
||||||
// 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 && dbUser.tenantId !== tenantId) {
|
||||||
throw `Email address ${email} already in use.`
|
throw `Email address ${email} already in use.`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ async function saveUser(
|
||||||
// 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 && account.verified) {
|
if (account && account.verified && account.tenantId !== tenantId) {
|
||||||
throw `Email address ${email} already in use.`
|
throw `Email address ${email} already in use.`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue