fix(07): UAT fixes — SMTP test email, DKV routing, Exchange domain field
- SMTP: add test-to field, send real email via sendMail() instead of verify() - SMTP: fix no_auth warning shown as error for open-relay servers - DKV: register dkv-fleet in MODULE_REGISTRY (fixes "Modul nicht gefunden") - DKV: add dynamic [category]/[moduleSlug]/settings + vehicles sub-routes - DKV: settings/vehicles links use useParams for consistent URLs - DKV: add gear icon settings link to module main page - DKV: rename module to "DKV-Rechnung" in seed + translations - DKV: add optional domain field for Exchange (WebCredentials 3rd arg) - DKV: hide IMAP-only fields (Port/Verschlüsselung/Ordner) when Exchange selected - DKV: hide Exchange-only field (Domain) when IMAP selected - Prisma: add domain column to DkvModuleConfig Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import { useParams } from 'next/navigation';
|
||||
import DkvFleetSettingsPage from '@/app/(portal)/modules/dkv-fleet/settings/page';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
const SETTINGS_REGISTRY: Record<string, React.ComponentType> = {
|
||||
'dkv-fleet': DkvFleetSettingsPage,
|
||||
};
|
||||
|
||||
export default function DynamicModuleSettingsPage() {
|
||||
const { moduleSlug } = useParams<{ category: string; moduleSlug: string }>();
|
||||
const t = useTranslations('modules');
|
||||
|
||||
const Component = SETTINGS_REGISTRY[moduleSlug ?? ''];
|
||||
if (!Component) {
|
||||
return (
|
||||
<div className="mx-auto max-w-2xl p-6 text-center text-muted-foreground">
|
||||
{t('notFound')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <Component />;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import { useParams } from 'next/navigation';
|
||||
import DkvFleetVehiclesPage from '@/app/(portal)/modules/dkv-fleet/vehicles/page';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
const VEHICLES_REGISTRY: Record<string, React.ComponentType> = {
|
||||
'dkv-fleet': DkvFleetVehiclesPage,
|
||||
};
|
||||
|
||||
export default function DynamicModuleVehiclesPage() {
|
||||
const { moduleSlug } = useParams<{ category: string; moduleSlug: string }>();
|
||||
const t = useTranslations('modules');
|
||||
|
||||
const Component = VEHICLES_REGISTRY[moduleSlug ?? ''];
|
||||
if (!Component) {
|
||||
return (
|
||||
<div className="mx-auto max-w-2xl p-6 text-center text-muted-foreground">
|
||||
{t('notFound')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <Component />;
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
import Link from 'next/link';
|
||||
import { checkNow, type DkvHistoryEntry } from '@/lib/dkv-api';
|
||||
import { InvoiceHistoryTable } from './components/InvoiceHistoryTable';
|
||||
import { ExportFileList } from './components/ExportFileList';
|
||||
@@ -33,6 +35,10 @@ function SpinnerIcon() {
|
||||
*/
|
||||
export default function DkvFleetPage() {
|
||||
const t = useTranslations('dkvFleet');
|
||||
const params = useParams<{ category?: string; moduleSlug?: string }>();
|
||||
const basePath = params.category && params.moduleSlug
|
||||
? `/modules/${params.category}/${params.moduleSlug}`
|
||||
: '/modules/dkv-fleet';
|
||||
|
||||
const [isChecking, setIsChecking] = useState(false);
|
||||
const [pollError, setPollError] = useState<string | null>(null);
|
||||
@@ -83,6 +89,18 @@ export default function DkvFleetPage() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Einstellungen-Link */}
|
||||
<Link
|
||||
href={`${basePath}/settings`}
|
||||
className="rounded border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
||||
title={t('settingsTitle')}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
||||
</svg>
|
||||
</Link>
|
||||
|
||||
{/* "Jetzt prüfen" button per 07-UI-SPEC button states */}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
+77
-48
@@ -64,6 +64,7 @@ interface FormState {
|
||||
pollIntervalMin: string;
|
||||
username: string;
|
||||
password: string; // intentionally blank on load (T-07-12)
|
||||
domain: string;
|
||||
exportRecipient: string;
|
||||
vehicleFormatString: string;
|
||||
isActive: boolean;
|
||||
@@ -79,6 +80,7 @@ const DEFAULT_FORM: FormState = {
|
||||
pollIntervalMin: '30',
|
||||
username: '',
|
||||
password: '', // blank — T-07-12
|
||||
domain: '',
|
||||
exportRecipient: '',
|
||||
vehicleFormatString: '{Marke}/{Modell}/{Kennzeichen}',
|
||||
isActive: false,
|
||||
@@ -95,6 +97,7 @@ function configToForm(config: DkvConfig): FormState {
|
||||
pollIntervalMin: String(config.pollIntervalMin),
|
||||
username: config.username ?? '',
|
||||
password: '', // NEVER pre-fill from server — T-07-12
|
||||
domain: config.domain ?? '',
|
||||
exportRecipient: config.exportRecipient,
|
||||
vehicleFormatString: config.vehicleFormatString,
|
||||
isActive: config.isActive,
|
||||
@@ -113,6 +116,7 @@ function formToPayload(
|
||||
senderFilter: form.senderFilter || undefined,
|
||||
pollIntervalMin: Number(form.pollIntervalMin),
|
||||
username: form.username || undefined,
|
||||
domain: form.domain || undefined,
|
||||
exportRecipient: form.exportRecipient,
|
||||
vehicleFormatString: form.vehicleFormatString,
|
||||
isActive: form.isActive,
|
||||
@@ -245,69 +249,94 @@ export function InboxConfigForm() {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Host */}
|
||||
{/* Host / EWS-URL */}
|
||||
<div>
|
||||
<label htmlFor="dkv-host" className={labelCls}>
|
||||
{t('form.host')} *
|
||||
{form.protocol === 'exchange' ? t('form.hostExchange') : t('form.host')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-host"
|
||||
type="text"
|
||||
required
|
||||
placeholder={form.protocol === 'exchange' ? 'https://mail.firma.de/EWS/Exchange.asmx' : 'imap.firma.de'}
|
||||
className={inputCls}
|
||||
value={form.host}
|
||||
onChange={(e) => update('host', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Port */}
|
||||
<div>
|
||||
<label htmlFor="dkv-port" className={labelCls}>
|
||||
{t('form.port')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-port"
|
||||
type="number"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.port}
|
||||
onChange={(e) => update('port', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
{/* IMAP-only: Port */}
|
||||
{form.protocol === 'imap' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-port" className={labelCls}>
|
||||
{t('form.port')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-port"
|
||||
type="number"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.port}
|
||||
onChange={(e) => update('port', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Verschlüsselung */}
|
||||
<div>
|
||||
<label htmlFor="dkv-encryption" className={labelCls}>
|
||||
{t('form.encryption')} *
|
||||
</label>
|
||||
<select
|
||||
id="dkv-encryption"
|
||||
className={inputCls}
|
||||
value={form.encryption}
|
||||
onChange={(e) =>
|
||||
update('encryption', e.target.value as 'none' | 'starttls' | 'ssl-tls')
|
||||
}
|
||||
>
|
||||
<option value="none">{t('form.encryptionNone')}</option>
|
||||
<option value="starttls">STARTTLS</option>
|
||||
<option value="ssl-tls">SSL-TLS</option>
|
||||
</select>
|
||||
</div>
|
||||
{/* IMAP-only: Verschlüsselung */}
|
||||
{form.protocol === 'imap' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-encryption" className={labelCls}>
|
||||
{t('form.encryption')} *
|
||||
</label>
|
||||
<select
|
||||
id="dkv-encryption"
|
||||
className={inputCls}
|
||||
value={form.encryption}
|
||||
onChange={(e) =>
|
||||
update('encryption', e.target.value as 'none' | 'starttls' | 'ssl-tls')
|
||||
}
|
||||
>
|
||||
<option value="none">{t('form.encryptionNone')}</option>
|
||||
<option value="starttls">STARTTLS</option>
|
||||
<option value="ssl-tls">SSL-TLS</option>
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Ordner */}
|
||||
<div>
|
||||
<label htmlFor="dkv-folder" className={labelCls}>
|
||||
{t('form.folder')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-folder"
|
||||
type="text"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.folder}
|
||||
onChange={(e) => update('folder', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
{/* IMAP-only: Ordner */}
|
||||
{form.protocol === 'imap' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-folder" className={labelCls}>
|
||||
{t('form.folder')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-folder"
|
||||
type="text"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.folder}
|
||||
onChange={(e) => update('folder', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Exchange-only: Domain */}
|
||||
{form.protocol === 'exchange' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-domain" className={labelCls}>
|
||||
{t('form.domain')}
|
||||
</label>
|
||||
<input
|
||||
id="dkv-domain"
|
||||
type="text"
|
||||
placeholder="CONTOSO"
|
||||
className={inputCls}
|
||||
value={form.domain}
|
||||
onChange={(e) => update('domain', e.target.value)}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-muted-foreground">{t('form.domainHelp')}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Absenderfilter */}
|
||||
<div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import Link from 'next/link';
|
||||
import { useState } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { InboxConfigForm } from './components/InboxConfigForm';
|
||||
|
||||
type ActiveTab = 'inbox' | 'vehicles';
|
||||
@@ -14,6 +15,10 @@ type ActiveTab = 'inbox' | 'vehicles';
|
||||
*/
|
||||
export default function DkvFleetSettingsPage() {
|
||||
const t = useTranslations('dkvFleet');
|
||||
const params = useParams<{ category?: string; moduleSlug?: string }>();
|
||||
const basePath = params.category && params.moduleSlug
|
||||
? `/modules/${params.category}/${params.moduleSlug}`
|
||||
: '/modules/dkv-fleet';
|
||||
const [activeTab, setActiveTab] = useState<ActiveTab>('inbox');
|
||||
|
||||
const tabCls = (tab: ActiveTab) =>
|
||||
@@ -41,7 +46,7 @@ export default function DkvFleetSettingsPage() {
|
||||
</button>
|
||||
{/* Vehicles tab navigates to its own route */}
|
||||
<Link
|
||||
href="/modules/dkv-fleet/vehicles"
|
||||
href={`${basePath}/vehicles`}
|
||||
className={`px-4 py-2 text-sm transition-colors text-muted-foreground hover:text-foreground`}
|
||||
>
|
||||
{t('tabs.vehicles')}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { VehicleTable } from '../settings/components/VehicleTable';
|
||||
|
||||
/**
|
||||
@@ -11,13 +12,17 @@ import { VehicleTable } from '../settings/components/VehicleTable';
|
||||
*/
|
||||
export default function DkvFleetVehiclesPage() {
|
||||
const t = useTranslations('dkvFleet');
|
||||
const params = useParams<{ category?: string; moduleSlug?: string }>();
|
||||
const basePath = params.category && params.moduleSlug
|
||||
? `/modules/${params.category}/${params.moduleSlug}`
|
||||
: '/modules/dkv-fleet';
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-5xl p-6">
|
||||
{/* Back link to settings */}
|
||||
<div className="mb-4">
|
||||
<Link
|
||||
href="/modules/dkv-fleet/settings"
|
||||
href={`${basePath}/settings`}
|
||||
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
← {t('tabs.inbox')} / {t('settingsTitle')}
|
||||
|
||||
@@ -51,6 +51,7 @@ export function SmtpSettingsForm() {
|
||||
const t = useTranslations('settings');
|
||||
|
||||
const [form, setForm] = useState<FormState>(DEFAULT_FORM);
|
||||
const [testTo, setTestTo] = useState('');
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [isTesting, setIsTesting] = useState(false);
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
@@ -114,10 +115,10 @@ export function SmtpSettingsForm() {
|
||||
setIsTesting(true);
|
||||
setTestFeedback({ type: 'loading', message: t('smtp.testTesting') });
|
||||
try {
|
||||
const result = await testSmtp(buildPayload());
|
||||
if (result.success && result.warning === 'no_auth') {
|
||||
setTestFeedback({ type: 'error', message: t('smtp.testNoAuth') });
|
||||
} else if (result.success) {
|
||||
const payload = buildPayload();
|
||||
if (testTo.trim()) payload.testTo = testTo.trim();
|
||||
const result = await testSmtp(payload);
|
||||
if (result.success) {
|
||||
setTestFeedback({ type: 'success', message: t('smtp.testSuccess') });
|
||||
} else {
|
||||
setTestFeedback({ type: 'error', message: t('smtp.testFailed') });
|
||||
@@ -126,7 +127,6 @@ export function SmtpSettingsForm() {
|
||||
setTestFeedback({ type: 'error', message: t('smtp.testFailed') });
|
||||
} finally {
|
||||
setIsTesting(false);
|
||||
// Auto-clear after 6 seconds
|
||||
clearTimerRef.current = setTimeout(() => setTestFeedback(null), 6000);
|
||||
}
|
||||
};
|
||||
@@ -300,6 +300,24 @@ export function SmtpSettingsForm() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Test-E-Mail Empfänger */}
|
||||
<div>
|
||||
<label htmlFor="smtp-test-to" className={labelClass}>
|
||||
{t('smtp.testToLabel')}
|
||||
</label>
|
||||
<input
|
||||
id="smtp-test-to"
|
||||
type="email"
|
||||
placeholder={t('smtp.testToPlaceholder')}
|
||||
className={inputClass}
|
||||
value={testTo}
|
||||
onChange={(e) => setTestTo(e.target.value)}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
{t('smtp.testToHelp')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Action row */}
|
||||
<div className="flex gap-3 pt-2">
|
||||
<button
|
||||
|
||||
@@ -28,6 +28,7 @@ export interface DkvConfig {
|
||||
exportRecipient: string;
|
||||
vehicleFormatString: string;
|
||||
username?: string | null;
|
||||
domain?: string | null;
|
||||
/** true if a password is stored server-side — never the actual secret */
|
||||
hasPassword: boolean;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,12 @@ export const MODULE_REGISTRY: Record<string, ModuleRegistryEntry> = {
|
||||
{ ssr: false },
|
||||
),
|
||||
},
|
||||
'dkv-fleet': {
|
||||
component: dynamic(
|
||||
() => import('@/app/(portal)/modules/dkv-fleet/page'),
|
||||
{ ssr: false },
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,8 @@ export interface SaveSmtpPayload {
|
||||
/** Only include when the user has typed a new password. */
|
||||
password?: string;
|
||||
fromAddress: string;
|
||||
/** If set, backend sends a real test email to this address instead of just verify(). */
|
||||
testTo?: string;
|
||||
}
|
||||
|
||||
// --- API functions ---
|
||||
|
||||
@@ -133,10 +133,12 @@
|
||||
"test": "Verbindung testen",
|
||||
"showPassword": "Passwort anzeigen",
|
||||
"hidePassword": "Passwort verbergen",
|
||||
"testToLabel": "Test-E-Mail an",
|
||||
"testToPlaceholder": "empfaenger@example.com",
|
||||
"testToHelp": "Optional — sendet eine echte Test-E-Mail an diese Adresse.",
|
||||
"testTesting": "Verbindung wird getestet...",
|
||||
"testSuccess": "Verbindung erfolgreich",
|
||||
"testFailed": "Verbindung fehlgeschlagen",
|
||||
"testNoAuth": "Server erreichbar, aber keine Zugangsdaten konfiguriert — E-Mail-Versand wird fehlschlagen"
|
||||
"testFailed": "Verbindung fehlgeschlagen"
|
||||
}
|
||||
},
|
||||
"widgets": {
|
||||
@@ -258,7 +260,7 @@
|
||||
"error": "Fehler bei der Pruefung"
|
||||
},
|
||||
"dkvFleet": {
|
||||
"pageTitle": "DKV Flotte",
|
||||
"pageTitle": "DKV-Rechnung",
|
||||
"checkNow": "Jetzt pruefen",
|
||||
"checking": "Wird geprueft...",
|
||||
"lastChecked": "Zuletzt geprueft: {time} Uhr",
|
||||
@@ -310,6 +312,9 @@
|
||||
"form": {
|
||||
"protocol": "Protokoll",
|
||||
"host": "Host",
|
||||
"hostExchange": "EWS-URL",
|
||||
"domain": "Domain",
|
||||
"domainHelp": "Optional — Windows-Domaene (z.B. CONTOSO). Leer lassen wenn nicht benoetigt.",
|
||||
"port": "Port",
|
||||
"encryption": "Verschluesselung",
|
||||
"encryptionNone": "Keine",
|
||||
|
||||
@@ -133,6 +133,9 @@
|
||||
"test": "Test Connection",
|
||||
"showPassword": "Show password",
|
||||
"hidePassword": "Hide password",
|
||||
"testToLabel": "Send test email to",
|
||||
"testToPlaceholder": "recipient@example.com",
|
||||
"testToHelp": "Optional — sends a real test email to this address.",
|
||||
"testTesting": "Testing connection...",
|
||||
"testSuccess": "Connection successful",
|
||||
"testFailed": "Connection failed"
|
||||
@@ -257,7 +260,7 @@
|
||||
"error": "Error checking domain"
|
||||
},
|
||||
"dkvFleet": {
|
||||
"pageTitle": "DKV Fleet",
|
||||
"pageTitle": "DKV Invoice",
|
||||
"checkNow": "Check Now",
|
||||
"checking": "Checking...",
|
||||
"lastChecked": "Last checked: {time}",
|
||||
@@ -309,6 +312,9 @@
|
||||
"form": {
|
||||
"protocol": "Protocol",
|
||||
"host": "Host",
|
||||
"hostExchange": "EWS URL",
|
||||
"domain": "Domain",
|
||||
"domainHelp": "Optional — Windows domain (e.g. CONTOSO). Leave blank if not required.",
|
||||
"port": "Port",
|
||||
"encryption": "Encryption",
|
||||
"encryptionNone": "None",
|
||||
|
||||
Reference in New Issue
Block a user