From 4f733821055b00daa097d7ecd811490ab081439c Mon Sep 17 00:00:00 2001 From: Indigo Tang Date: Sun, 6 Jul 2025 12:27:23 +0000 Subject: [PATCH] add default user admin@example.com to database --- src/app/actions/user.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/actions/user.ts b/src/app/actions/user.ts index e2465a3..035d628 100644 --- a/src/app/actions/user.ts +++ b/src/app/actions/user.ts @@ -96,12 +96,10 @@ interface DeleteUserResult { export async function deleteUser(id: string): Promise { try { + const user = getUserById(id); // Prevent deleting the main admin/user accounts for demo stability - if (id.startsWith('user-seed-') || id === 'admin-main') { - const user = getUserById(id); - if(user?.email === 'user@example.com' || user?.email === 'admin@example.com') { - return { success: false, message: 'This is a protected demo account and cannot be deleted.' }; - } + if (user && (user.email === 'user@example.com' || user.email === 'admin@example.com')) { + return { success: false, message: 'This is a protected demo account and cannot be deleted.' }; } const stmt = db.prepare('DELETE FROM users WHERE id = ?');