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:
17
api.php
17
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'],
|
||||
|
||||
Reference in New Issue
Block a user