fix: remove role gate from Settings, all strings in English

This commit is contained in:
Brückner
2026-06-03 16:08:05 +02:00
parent d364aea4c1
commit f7999cbe55
4 changed files with 31 additions and 44 deletions

View File

@ -156,7 +156,7 @@ async function startServer() {
app.get('/api/auth/azure', async (_req, res) => {
const msalClient = getMsalClient();
if (!msalClient) {
return res.redirect('/?auth_error=Azure+Login+nicht+konfiguriert');
return res.redirect('/?auth_error=Azure+login+not+configured');
}
const appUrl = process.env.APP_URL || `http://localhost:${PORT}`;
const redirectUri = getSetting('azure_redirect_uri') || `${appUrl}/api/auth/azure/callback`;
@ -168,7 +168,7 @@ async function startServer() {
res.redirect(authCodeUrl);
} catch (err: any) {
console.error('[Azure Auth] getAuthCodeUrl error:', err);
res.redirect('/?auth_error=Microsoft+Login+konnte+nicht+gestartet+werden');
res.redirect('/?auth_error=Failed+to+start+Microsoft+login');
}
});
@ -180,11 +180,11 @@ async function startServer() {
return res.redirect(`/?auth_error=${msg}`);
}
if (!code) {
return res.redirect('/?auth_error=Kein+Autorisierungscode+erhalten');
return res.redirect('/?auth_error=No+authorization+code+received');
}
const msalClient = getMsalClient();
if (!msalClient) {
return res.redirect('/?auth_error=Azure+Login+nicht+konfiguriert');
return res.redirect('/?auth_error=Azure+login+not+configured');
}
const appUrl = process.env.APP_URL || `http://localhost:${PORT}`;
const redirectUri = getSetting('azure_redirect_uri') || `${appUrl}/api/auth/azure/callback`;
@ -197,7 +197,7 @@ async function startServer() {
const email = (result.account?.username ?? '').toLowerCase();
const name = result.account?.name || email;
if (!email) {
return res.redirect('/?auth_error=Keine+E-Mail+von+Microsoft+erhalten');
return res.redirect('/?auth_error=No+email+returned+by+Microsoft');
}
let user = db.prepare('SELECT id, name, role, email FROM users WHERE email = ?').get(email) as User | undefined;
if (!user) {
@ -210,14 +210,14 @@ async function startServer() {
res.redirect(`/?token=${encodeURIComponent(token)}`);
} catch (err: any) {
console.error('[Azure Auth] acquireTokenByCode error:', err);
res.redirect('/?auth_error=Authentifizierung+fehlgeschlagen');
res.redirect('/?auth_error=Authentication+failed');
}
});
// -------------------------------------------------------------
// RESTFUL API: Settings (admin only)
// -------------------------------------------------------------
app.get('/api/settings', requireAuth, requireAdmin, (_req, res) => {
app.get('/api/settings', requireAuth, (_req, res) => {
try {
res.json(maskSettings(getAllSettings()));
} catch (err: any) {
@ -225,7 +225,7 @@ async function startServer() {
}
});
app.put('/api/settings', requireAuth, requireAdmin, (req, res) => {
app.put('/api/settings', requireAuth, (req, res) => {
try {
const allowed = ['azure_enabled', 'azure_client_id', 'azure_tenant_id', 'azure_client_secret',
'azure_redirect_uri', 'checkmk_api_url', 'checkmk_api_secret', 'checkmk_sync_interval_ms'];