Making logic around logout very explicit.
This commit is contained in:
parent
70d91acc41
commit
b6be98fa4e
|
@ -42,12 +42,9 @@
|
|||
}
|
||||
|
||||
// check if real tenant
|
||||
const info = await tenants.info(urlTenantId)
|
||||
if (!info.exists) {
|
||||
return
|
||||
}
|
||||
const { exists: tenantExists } = await tenants.info(urlTenantId)
|
||||
|
||||
if (urlTenantId && user.tenantId !== urlTenantId) {
|
||||
if (tenantExists && user.tenantId !== urlTenantId) {
|
||||
// user should not be here - play it safe and log them out
|
||||
try {
|
||||
await auth.logout()
|
||||
|
|
|
@ -6,6 +6,9 @@ export function tenantsStore() {
|
|||
|
||||
return {
|
||||
info: async tenantId => {
|
||||
if (!tenantId) {
|
||||
return { exists: false }
|
||||
}
|
||||
const contents = get(store)
|
||||
const found = contents.tenantInfo[tenantId]
|
||||
if (found) {
|
||||
|
|
Loading…
Reference in New Issue