Merge pull request #13004 from Budibase/fix/custom-branding-issue
Fix for custom branding not appearing on login
This commit is contained in:
commit
c86e1675b0
|
@ -1 +1 @@
|
||||||
Subproject commit 8cbe73c9dc39d0bda3dbca3dac345a4a1f916f18
|
Subproject commit 1ba8414bed14439512153cf851086146a80560f5
|
|
@ -1,6 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { auth, admin } from "stores/portal"
|
import { auth, admin } from "stores/portal"
|
||||||
import { redirect } from "@roxi/routify"
|
import { redirect } from "@roxi/routify"
|
||||||
|
import { CookieUtils } from "@budibase/frontend-core"
|
||||||
|
|
||||||
// If already authenticated, redirect away from the auth section.
|
// If already authenticated, redirect away from the auth section.
|
||||||
// Check this onMount rather than a reactive statement to avoid trumping
|
// Check this onMount rather than a reactive statement to avoid trumping
|
||||||
|
@ -9,6 +10,15 @@
|
||||||
$redirect("../")
|
$redirect("../")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($admin?.checklist?.branding) {
|
||||||
|
let url = new URL(window.location.href)
|
||||||
|
let hostname = url.hostname
|
||||||
|
let parts = hostname.split(".")
|
||||||
|
let tenantId = parts[0]
|
||||||
|
let domain = parts.slice(-2).join(".")
|
||||||
|
CookieUtils.setCookie("tenantId", tenantId, domain)
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!$auth.user &&
|
!$auth.user &&
|
||||||
$admin.cloud &&
|
$admin.cloud &&
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
export function setCookie(name, value) {
|
export function setCookie(name, value, domain) {
|
||||||
if (getCookie(name)) {
|
if (getCookie(name)) {
|
||||||
removeCookie(name)
|
removeCookie(name)
|
||||||
}
|
}
|
||||||
window.document.cookie = `${name}=${value}; Path=/;`
|
let cookieString = `${name}=${value}; Path=/;`
|
||||||
|
if (domain) {
|
||||||
|
cookieString += ` Domain=${domain};`
|
||||||
|
}
|
||||||
|
window.document.cookie = cookieString
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCookie(cookieName) {
|
export function getCookie(cookieName) {
|
||||||
|
|
|
@ -498,6 +498,12 @@ export async function configChecklist(ctx: Ctx) {
|
||||||
|
|
||||||
// They have set up a global user
|
// They have set up a global user
|
||||||
const userExists = await checkAnyUserExists()
|
const userExists = await checkAnyUserExists()
|
||||||
|
|
||||||
|
// They have set up branding
|
||||||
|
const configDoc = await configs.getSettingsConfigDoc()
|
||||||
|
const config = configDoc.config
|
||||||
|
const branding = await pro.branding.getBrandingConfig(config)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
apps: {
|
apps: {
|
||||||
checked: apps.length > 0,
|
checked: apps.length > 0,
|
||||||
|
@ -519,6 +525,7 @@ export async function configChecklist(ctx: Ctx) {
|
||||||
label: "Set up single sign-on",
|
label: "Set up single sign-on",
|
||||||
link: "/builder/portal/settings/auth",
|
link: "/builder/portal/settings/auth",
|
||||||
},
|
},
|
||||||
|
branding,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue