Making logic around logout very explicit.

This commit is contained in:
mike12345567 2023-03-29 14:22:07 +01:00
parent 70d91acc41
commit b6be98fa4e
2 changed files with 5 additions and 5 deletions

View File

@ -42,12 +42,9 @@
} }
// check if real tenant // check if real tenant
const info = await tenants.info(urlTenantId) const { exists: tenantExists } = await tenants.info(urlTenantId)
if (!info.exists) {
return
}
if (urlTenantId && user.tenantId !== urlTenantId) { if (tenantExists && user.tenantId !== urlTenantId) {
// user should not be here - play it safe and log them out // user should not be here - play it safe and log them out
try { try {
await auth.logout() await auth.logout()

View File

@ -6,6 +6,9 @@ export function tenantsStore() {
return { return {
info: async tenantId => { info: async tenantId => {
if (!tenantId) {
return { exists: false }
}
const contents = get(store) const contents = get(store)
const found = contents.tenantInfo[tenantId] const found = contents.tenantInfo[tenantId]
if (found) { if (found) {