add default user admin@example.com to database
This commit is contained in:
parent
861ec9280e
commit
4f73382105
|
|
@ -96,13 +96,11 @@ interface DeleteUserResult {
|
||||||
|
|
||||||
export async function deleteUser(id: string): Promise<DeleteUserResult> {
|
export async function deleteUser(id: string): Promise<DeleteUserResult> {
|
||||||
try {
|
try {
|
||||||
// Prevent deleting the main admin/user accounts for demo stability
|
|
||||||
if (id.startsWith('user-seed-') || id === 'admin-main') {
|
|
||||||
const user = getUserById(id);
|
const user = getUserById(id);
|
||||||
if(user?.email === 'user@example.com' || user?.email === 'admin@example.com') {
|
// Prevent deleting the main admin/user accounts for demo stability
|
||||||
|
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.' };
|
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 = ?');
|
||||||
const info = stmt.run(id);
|
const info = stmt.run(id);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue