feat(auth): add MINDA_DEMO support with auto-seeded demo accounts and username login
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 59s

This commit is contained in:
sandrodach committed 2026-10-25 10:12:13 +01:00
1 parent 41c64c4924
commit 7f312fef14
12 files changed
+297 -23

No files matched your search

@@ -399,13 +399,44 @@ export const SetupAndAuthView: React.FC<SetupAndAuthViewProps> = ({
{authTab === 'login' && (
<form onSubmit={handleLogin} className="space-y-3.5">
{authStatus.demoMode && (
<div className="p-2.5 rounded border border-accent/30 bg-accent/10 space-y-1.5">
<div className="flex items-center justify-between text-[11px] font-semibold text-accent">
<span>🧪 Demo-Modus aktiv</span>
<span className="text-[10px] text-muted font-normal">Klick zum Ausfüllen:</span>
</div>
<div className="flex gap-2">
<button
type="button"
onClick={() => {
setEmail('admin');
setPassword('admin');
}}
className="flex-1 py-1 px-2 text-[11px] rounded bg-panel hover:bg-panel-elevated border border-border text-main font-mono transition-colors text-center"
>
admin / admin
</button>
<button
type="button"
onClick={() => {
setEmail('user');
setPassword('user');
}}
className="flex-1 py-1 px-2 text-[11px] rounded bg-panel hover:bg-panel-elevated border border-border text-main font-mono transition-colors text-center"
>
user / user
</button>
</div>
</div>
)}
<div>
<label className="block text-muted mb-1">E-Mail-Adresse</label>
<label className="block text-muted mb-1">Benutzername oder E-Mail-Adresse</label>
<input
type="email"
type="text"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="name@beispiel.de"
placeholder="admin oder name@beispiel.de"
required
autoFocus
className="w-full h-8 px-2.5 input-field"
+2 -2
View File
@@ -125,10 +125,10 @@ export const api = {
return res;
},
async login(email: string, password: string): Promise<{ token: string; user: User }> {
async login(loginOrEmail: string, password: string): Promise<{ token: string; user: User }> {
const res = await request<{ token: string; user: User }>('/api/v1/auth/login', {
method: 'POST',
body: JSON.stringify({ email, password }),
body: JSON.stringify({ email: loginOrEmail, username: loginOrEmail, login: loginOrEmail, password }),
});
setToken(res.token);
return res;
+2
View File
@@ -6,11 +6,13 @@ export interface AuthStatus {
needsSetup: boolean;
allowRegistration: boolean;
instanceName: string;
demoMode?: boolean;
}
export interface User {
id: string;
email: string;
username?: string;
displayName: string;
role: UserRole;
isActive: boolean;