The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
Merge branch 'main' into feat/mfa
Fernando Bona66ae577b7b74
diff --cc client/src/i18n/translations/de.tsindex 428cbbde2,0421e1ff4..d18384c59--- a/client/src/i18n/translations/de.ts+++ b/client/src/i18n/translations/de.ts@@@ -222,14 -206,8 +222,15 @@@ const de: Record<string, string> ='login.oidc.invalidState': 'Ungültige Sitzung. Bitte erneut versuchen.','login.demoFailed': 'Demo-Login fehlgeschlagen','login.oidcSignIn': 'Anmelden mit {name}',+ 'login.oidcOnly': 'Passwort-Authentifizierung ist deaktiviert. Bitte melde dich über deinen SSO-Anbieter an.','login.demoHint': 'Demo ausprobieren — ohne Registrierung',+ 'login.mfaTitle': 'Zwei-Faktor-Authentifizierung',+ 'login.mfaSubtitle': 'Gib den 6-stelligen Code aus deiner Authenticator-App ein.',+ 'login.mfaCodeLabel': 'Bestätigungscode',+ 'login.mfaCodeRequired': 'Bitte den Code aus der Authenticator-App eingeben.',+ 'login.mfaHint': 'Google Authenticator, Authy oder eine andere TOTP-App öffnen.',+ 'login.mfaBack': '← Zurück zur Anmeldung',+ 'login.mfaVerify': 'Bestätigen',// Register'register.passwordMismatch': 'Passwörter stimmen nicht überein',diff --cc client/src/i18n/translations/en.tsindex 6bf8718d9,33c828ae4..177818147--- a/client/src/i18n/translations/en.ts+++ b/client/src/i18n/translations/en.ts@@@ -222,14 -206,8 +222,15 @@@ const en: Record<string, string> ='login.oidc.invalidState': 'Invalid session. Please try again.','login.demoFailed': 'Demo login failed','login.oidcSignIn': 'Sign in with {name}',+ 'login.oidcOnly': 'Password authentication is disabled. Please sign in using your SSO provider.','login.demoHint': 'Try the demo — no registration needed',+ 'login.mfaTitle': 'Two-factor authentication',+ 'login.mfaSubtitle': 'Enter the 6-digit code from your authenticator app.',+ 'login.mfaCodeLabel': 'Verification code',+ 'login.mfaCodeRequired': 'Enter the code from your authenticator app.',+ 'login.mfaHint': 'Open Google Authenticator, Authy, or another TOTP app.',+ 'login.mfaBack': '← Back to sign in',+ 'login.mfaVerify': 'Verify',// Register'register.passwordMismatch': 'Passwords do not match',diff --cc client/src/pages/LoginPage.tsxindex df4c8874e,2b4cc4e26..2f3344d09--- a/client/src/pages/LoginPage.tsx+++ b/client/src/pages/LoginPage.tsx@@@ -455,19 -443,39 +464,47 @@@ export default function LoginPage(): Re</div><div style={{ background: 'white', borderRadius: 20, border: '1px solid #e5e7eb', padding: '36px 32px', boxShadow: '0 2px 16px rgba(0,0,0,0.06)' }}>+ {oidcOnly ? (+ <>+ <h2 style={{ margin: '0 0 4px', fontSize: 22, fontWeight: 800, color: '#111827' }}>{t('login.title')}</h2>+ <p style={{ margin: '0 0 24px', fontSize: 13.5, color: '#9ca3af' }}>{t('login.oidcOnly')}</p>+ {error && (+ <div style={{ padding: '10px 14px', background: '#fef2f2', border: '1px solid #fecaca', borderRadius: 10, fontSize: 13, color: '#dc2626', marginBottom: 16 }}>+ {error}+ </div>+ )}+ <a href="/api/auth/oidc/login"+ style={{+ width: '100%', padding: '12px',+ background: '#111827', color: 'white',+ border: 'none', borderRadius: 12,+ fontSize: 14, fontWeight: 700, cursor: 'pointer',+ fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8,+ textDecoration: 'none', transition: 'all 0.15s',+ boxSizing: 'border-box',+ }}+ onMouseEnter={(e: React.MouseEvent<HTMLAnchorElement>) => { e.currentTarget.style.background = '#1f2937' }}+ onMouseLeave={(e: React.MouseEvent<HTMLAnchorElement>) => { e.currentTarget.style.background = '#111827' }}+ >+ <Shield size={16} />+ {t('login.oidcSignIn', { name: appConfig?.oidc_display_name || 'SSO' })}+ </a>+ </>+ ) : (+ <><h2 style={{ margin: '0 0 4px', fontSize: 22, fontWeight: 800, color: '#111827' }}>- {mode === 'register' ? (!appConfig?.has_users ? t('login.createAdmin') : t('login.createAccount')) : t('login.title')}+ {mode === 'login' && mfaStep+ ? t('login.mfaTitle')+ : mode === 'register'+ ? (!appConfig?.has_users ? t('login.createAdmin') : t('login.createAccount'))+ : t('login.title')}</h2><p style={{ margin: '0 0 28px', fontSize: 13.5, color: '#9ca3af' }}>- {mode === 'register' ? (!appConfig?.has_users ? t('login.createAdminHint') : t('login.createAccountHint')) : t('login.subtitle')}+ {mode === 'login' && mfaStep+ ? t('login.mfaSubtitle')+ : mode === 'register'+ ? (!appConfig?.has_users ? t('login.createAdminHint') : t('login.createAccountHint'))+ : t('login.subtitle')}</p><form onSubmit={handleSubmit} style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>diff --cc client/src/pages/SettingsPage.tsxindex 2cd985dce,1ebc869ca..8b0d3d2e8--- a/client/src/pages/SettingsPage.tsx+++ b/client/src/pages/SettingsPage.tsx@@@ -71,14 -71,14 +71,21 @@@ export default function SettingsPage()const [currentPassword, setCurrentPassword] = useState<string>('')const [newPassword, setNewPassword] = useState<string>('')const [confirmPassword, setConfirmPassword] = useState<string>('')+ const [oidcOnlyMode, setOidcOnlyMode] = useState<boolean>(false)++ useEffect(() => {+ authApi.getAppConfig?.().then((config) => {+ if (config?.oidc_only_mode) setOidcOnlyMode(true)+ }).catch(() => {})+ }, [])+ const [mfaQr, setMfaQr] = useState<string | null>(null)+ const [mfaSecret, setMfaSecret] = useState<string | null>(null)+ const [mfaSetupCode, setMfaSetupCode] = useState('')+ const [mfaDisablePwd, setMfaDisablePwd] = useState('')+ const [mfaDisableCode, setMfaDisableCode] = useState('')+ const [mfaLoading, setMfaLoading] = useState(false)+useEffect(() => {setMapTileUrl(settings.map_tile_url || '')setDefaultLat(settings.default_lat || 48.8566)@@@ -453,146 -455,8 +462,147 @@@</button></div></div>+ )}+ {/* MFA */}+ <div style={{ paddingTop: 8, marginTop: 8, borderTop: '1px solid var(--border-secondary)' }}>+ <div className="flex items-center gap-2 mb-3">+ <KeyRound className="w-5 h-5" style={{ color: 'var(--text-secondary)' }} />+ <h3 className="font-semibold text-base m-0" style={{ color: 'var(--text-primary)' }}>{t('settings.mfa.title')}</h3>+ </div>+ <div className="space-y-3">+ <p className="text-sm m-0" style={{ color: 'var(--text-muted)', lineHeight: 1.5 }}>{t('settings.mfa.description')}</p>+ {demoMode ? (+ <p className="text-sm text-amber-700 m-0">{t('settings.mfa.demoBlocked')}</p>+ ) : (+ <>+ <p className="text-sm font-medium m-0" style={{ color: 'var(--text-secondary)' }}>+ {user?.mfa_enabled ? t('settings.mfa.enabled') : t('settings.mfa.disabled')}+ </p>++ {!user?.mfa_enabled && !mfaQr && (+ <button+ type="button"+ disabled={mfaLoading}+ onClick={async () => {+ setMfaLoading(true)+ try {+ const data = await authApi.mfaSetup() as { qr_data_url: string; secret: string }+ setMfaQr(data.qr_data_url)+ setMfaSecret(data.secret)+ setMfaSetupCode('')+ } catch (err: unknown) {+ toast.error(getApiErrorMessage(err, t('common.error')))+ } finally {+ setMfaLoading(false)+ }+ }}+ className="flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors"+ style={{ border: '1px solid var(--border-primary)', background: 'var(--bg-card)', color: 'var(--text-primary)' }}+ >+ {mfaLoading ? <div className="w-4 h-4 border-2 border-slate-300 border-t-slate-700 rounded-full animate-spin" /> : <KeyRound size={14} />}+ {t('settings.mfa.setup')}+ </button>+ )}++ {!user?.mfa_enabled && mfaQr && (+ <div className="space-y-3">+ <p className="text-sm" style={{ color: 'var(--text-muted)' }}>{t('settings.mfa.scanQr')}</p>+ <img src={mfaQr} alt="" className="rounded-lg border mx-auto block" style={{ maxWidth: 200, borderColor: 'var(--border-primary)' }} />+ <div>+ <label className="block text-xs font-medium mb-1" style={{ color: 'var(--text-secondary)' }}>{t('settings.mfa.secretLabel')}</label>+ <code className="block text-xs p-2 rounded break-all" style={{ background: 'var(--bg-hover)', color: 'var(--text-primary)' }}>{mfaSecret}</code>+ </div>+ <input+ type="text"+ inputMode="numeric"+ value={mfaSetupCode}+ onChange={(e) => setMfaSetupCode(e.target.value.replace(/\D/g, '').slice(0, 8))}+ placeholder={t('settings.mfa.codePlaceholder')}+ className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm"+ />+ <div className="flex flex-wrap gap-2">+ <button+ type="button"+ disabled={mfaLoading || mfaSetupCode.length < 6}+ onClick={async () => {+ setMfaLoading(true)+ try {+ await authApi.mfaEnable({ code: mfaSetupCode })+ toast.success(t('settings.mfa.toastEnabled'))+ setMfaQr(null)+ setMfaSecret(null)+ setMfaSetupCode('')+ await loadUser()+ } catch (err: unknown) {+ toast.error(getApiErrorMessage(err, t('common.error')))+ } finally {+ setMfaLoading(false)+ }+ }}+ className="px-4 py-2 bg-slate-900 text-white rounded-lg text-sm hover:bg-slate-700 disabled:opacity-50"+ >+ {t('settings.mfa.enable')}+ </button>+ <button+ type="button"+ onClick={() => { setMfaQr(null); setMfaSecret(null); setMfaSetupCode('') }}+ className="px-4 py-2 rounded-lg text-sm border"+ style={{ borderColor: 'var(--border-primary)', color: 'var(--text-secondary)' }}+ >+ {t('settings.mfa.cancelSetup')}+ </button>+ </div>+ </div>+ )}++ {user?.mfa_enabled && (+ <div className="space-y-3">+ <p className="text-sm font-medium" style={{ color: 'var(--text-secondary)' }}>{t('settings.mfa.disableTitle')}</p>+ <p className="text-xs" style={{ color: 'var(--text-muted)' }}>{t('settings.mfa.disableHint')}</p>+ <input+ type="password"+ value={mfaDisablePwd}+ onChange={(e) => setMfaDisablePwd(e.target.value)}+ placeholder={t('settings.currentPassword')}+ className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm"+ />+ <input+ type="text"+ inputMode="numeric"+ value={mfaDisableCode}+ onChange={(e) => setMfaDisableCode(e.target.value.replace(/\D/g, '').slice(0, 8))}+ placeholder={t('settings.mfa.codePlaceholder')}+ className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm"+ />+ <button+ type="button"+ disabled={mfaLoading || !mfaDisablePwd || mfaDisableCode.length < 6}+ onClick={async () => {+ setMfaLoading(true)+ try {+ await authApi.mfaDisable({ password: mfaDisablePwd, code: mfaDisableCode })+ toast.success(t('settings.mfa.toastDisabled'))+ setMfaDisablePwd('')+ setMfaDisableCode('')+ await loadUser()+ } catch (err: unknown) {+ toast.error(getApiErrorMessage(err, t('common.error')))+ } finally {+ setMfaLoading(false)+ }+ }}+ className="px-4 py-2 rounded-lg text-sm font-medium text-red-600 border border-red-200 hover:bg-red-50 disabled:opacity-50"+ >+ {t('settings.mfa.disable')}+ </button>+ </div>+ )}+ </>+ )}+ </div>+ </div>+<div className="flex items-center gap-4"><div style={{ position: 'relative', flexShrink: 0 }}>{user?.avatar_url ? (diff --cc server/src/db/migrations.tsindex 0a30fed56,a56f08e2f..2c1161a5a--- a/server/src/db/migrations.ts+++ b/server/src/db/migrations.ts@@@ -194,8 -194,16 +194,18 @@@ function runMigrations(db: Database.Dattry { db.exec('ALTER TABLE reservations ADD COLUMN reservation_end_time TEXT'); } catch {}},() => {+ try { db.exec('ALTER TABLE users ADD COLUMN mfa_enabled INTEGER DEFAULT 0'); } catch {}+ try { db.exec('ALTER TABLE users ADD COLUMN mfa_secret TEXT'); } catch {}+ try { db.exec('ALTER TABLE places ADD COLUMN osm_id TEXT'); } catch {}+ },+ () => {+ try { db.exec('ALTER TABLE trip_files ADD COLUMN uploaded_by INTEGER REFERENCES users(id) ON DELETE SET NULL'); } catch {}+ try { db.exec('ALTER TABLE trip_files ADD COLUMN starred INTEGER DEFAULT 0'); } catch {}+ try { db.exec('ALTER TABLE trip_files ADD COLUMN deleted_at TEXT'); } catch {}+ },+ () => {+ try { db.exec('ALTER TABLE reservations ADD COLUMN accommodation_id INTEGER REFERENCES day_accommodations(id) ON DELETE SET NULL'); } catch {}+ try { db.exec('ALTER TABLE reservations ADD COLUMN metadata TEXT'); } catch {}},];diff --cc server/src/routes/auth.tsindex b14f61a3c,7516d3a60..d4bbe3111--- a/server/src/routes/auth.ts+++ b/server/src/routes/auth.ts@@@ -139,10 -121,10 +153,10 @@@ router.post('/demo-login', (_req: Requeif (process.env.DEMO_MODE !== 'true') {return res.status(404).json({ error: 'Not found' });}- const user = db.prepare('SELECT * FROM users WHERE email = ?').get('[email protected]') as User | undefined;+ const user = db.prepare('SELECT * FROM users WHERE email = ?').get('[email protected]') as User | undefined;if (!user) return res.status(500).json({ error: 'Demo user not found' });const token = generateToken(user);- const { password_hash, maps_api_key, openweather_api_key, unsplash_api_key, ...safe } = user;+ const safe = stripUserForClient(user) as Record<string, unknown>;res.json({ token, user: { ...safe, avatar_url: avatarUrl(user) } });});