From c8dce63f6ef7881bb5c997e16cead8a8309f98e9 Mon Sep 17 00:00:00 2001 From: Jukka Lampikoski Date: Tue, 10 Mar 2026 16:56:52 +0200 Subject: [PATCH] fix: use domain-based branding in check_auth response check_auth was returning branding based on active company with wrong field name (company_nimi instead of nimi), causing Noxus Intra to show instead of company name on refresh. Now uses dbGetBranding() with the request domain, same as the branding endpoint. Co-Authored-By: Claude Opus 4.6 --- api.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/api.php b/api.php index cb26ae6..e697d35 100644 --- a/api.php +++ b/api.php @@ -845,20 +845,9 @@ switch ($action) { } // Hae allekirjoitukset $userSignatures = $u ? ($u['signatures'] ?? []) : []; - // Brändäystiedot aktiivisesta yrityksestä - $branding = ['primary_color' => '#0f3460', 'subtitle' => '', 'logo_url' => '', 'company_nimi' => '']; - $activeCompanyId = $_SESSION['company_id'] ?? ''; - foreach ($allCompanies as $bc) { - if ($bc['id'] === $activeCompanyId) { - $branding['primary_color'] = $bc['primary_color'] ?? '#0f3460'; - $branding['subtitle'] = $bc['subtitle'] ?? ''; - $branding['company_nimi'] = $bc['nimi'] ?? ''; - $branding['logo_url'] = !empty($bc['logo_file']) - ? "api.php?action=company_logo&company_id=" . urlencode($bc['id']) - : ''; - break; - } - } + // Brändäystiedot domain-pohjaisesti (sama kuin branding-endpoint) + $host = strtolower(explode(':', $_SERVER['HTTP_HOST'] ?? '')[0]); + $branding = dbGetBranding($host); echo json_encode([ 'authenticated' => true, 'user_id' => $_SESSION['user_id'],