feat: způsob přihlášení a správa obchodů podle konfigurace serveru
CI / Generate TypeScript types (push) Successful in 12s
CI / Server unit tests (push) Successful in 26s
CI / Build server (push) Successful in 32s
CI / Build client (push) Successful in 41s
CI / Playwright E2E tests (push) Successful in 1m47s
CI / Build and push Docker image (push) Successful in 49s
CI / Notify (push) Successful in 2s

This commit is contained in:
2026-09-24 09:30:04 +02:00
parent 103445dba8
commit 5f54925808
10 changed files with 185 additions and 82 deletions
+8 -1
View File
@@ -140,6 +140,12 @@ app.get("/api/config", (_req, res) => {
limits: {
group: getGroupLimits(),
},
auth: {
trustedHeaders: HTTP_REMOTE_USER_ENABLED,
},
features: {
storeAdmin: !!process.env.ADMIN_PASSWORD,
},
});
});
@@ -160,7 +166,8 @@ app.post("/api/login", (req, res) => {
if (remoteUser && remoteUser.length > 0) {
res.status(200).json(generateToken(Buffer.from(remoteUser, 'latin1').toString(), true));
} else {
throw new Error("Je zapnuto přihlášení přes hlavičky, ale nepřišla hlavička nebo ??");
// Přihlašuje proxy (trusted headers) — bez hlavičky nejde o chybu serveru, ale o nepřihlášeného uživatele
res.status(401).json({ error: 'Přihlášení probíhá přes firemní přihlášení (proxy), ale nepřišla identita uživatele. Zkuste stránku obnovit nebo se přihlásit znovu.' });
}
} else {
if (!req.body?.login || req.body.login.trim().length === 0) {