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 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 16:56:52 +02:00
parent 6ae25006b8
commit c8dce63f6e

17
api.php
View File

@@ -845,20 +845,9 @@ switch ($action) {
} }
// Hae allekirjoitukset // Hae allekirjoitukset
$userSignatures = $u ? ($u['signatures'] ?? []) : []; $userSignatures = $u ? ($u['signatures'] ?? []) : [];
// Brändäystiedot aktiivisesta yrityksestä // Brändäystiedot domain-pohjaisesti (sama kuin branding-endpoint)
$branding = ['primary_color' => '#0f3460', 'subtitle' => '', 'logo_url' => '', 'company_nimi' => '']; $host = strtolower(explode(':', $_SERVER['HTTP_HOST'] ?? '')[0]);
$activeCompanyId = $_SESSION['company_id'] ?? ''; $branding = dbGetBranding($host);
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;
}
}
echo json_encode([ echo json_encode([
'authenticated' => true, 'authenticated' => true,
'user_id' => $_SESSION['user_id'], 'user_id' => $_SESSION['user_id'],