add default user admin@example.com to database
This commit is contained in:
@@ -96,12 +96,10 @@ interface DeleteUserResult {
|
|||||||
|
|
||||||
export async function deleteUser(id: string): Promise<DeleteUserResult> {
|
export async function deleteUser(id: string): Promise<DeleteUserResult> {
|
||||||
try {
|
try {
|
||||||
|
const user = getUserById(id);
|
||||||
// Prevent deleting the main admin/user accounts for demo stability
|
// Prevent deleting the main admin/user accounts for demo stability
|
||||||
if (id.startsWith('user-seed-') || id === 'admin-main') {
|
if (user && (user.email === 'user@example.com' || user.email === 'admin@example.com')) {
|
||||||
const user = getUserById(id);
|
return { success: false, message: 'This is a protected demo account and cannot be deleted.' };
|
||||||
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.' };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const stmt = db.prepare('DELETE FROM users WHERE id = ?');
|
const stmt = db.prepare('DELETE FROM users WHERE id = ?');
|
||||||
|
|||||||
Reference in New Issue
Block a user