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
|
// 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'],
|
||||||
|
|||||||
Reference in New Issue
Block a user