Merge pull request #13064 from Budibase/fix/branding-cookie-update

Handle branding cookies with different tenant ids
This commit is contained in:
Martin McKeaveney 2024-02-22 19:10:53 +02:00 committed by GitHub
commit 51fbd50b46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

@ -1 +1 @@
Subproject commit a851eeacabfaad8bff6e781f5e5a62063cbc31f3 Subproject commit ab324e35d855012bd0f49caa53c6dd765223c6fa

View File

@ -10,13 +10,18 @@
$redirect("../") $redirect("../")
} }
if ($admin?.checklist?.branding) { if ($admin?.cloud && $admin?.checklist?.branding) {
let url = new URL(window.location.href) let url = new URL(window.location.href)
let hostname = url.hostname let hostname = url.hostname
let parts = hostname.split(".") let parts = hostname.split(".")
let tenantId = parts[0] let newTenantId = parts[0]
let domain = parts.slice(-2).join(".") let domain = parts.slice(-2).join(".")
CookieUtils.setCookie("tenantId", tenantId, domain)
let existingTenantId = CookieUtils.getCookie("tenantId")
if (!existingTenantId || existingTenantId !== newTenantId) {
CookieUtils.setCookie("tenantId", newTenantId, domain)
}
} }
if ( if (