mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
fix account delete bug
This commit is contained in:
parent
e558192790
commit
3a617b7bfa
@ -43,7 +43,7 @@ export default async (req, res) => {
|
|||||||
const accountByUsername = await getAccount({ username });
|
const accountByUsername = await getAccount({ username });
|
||||||
|
|
||||||
if (accountByUsername) {
|
if (accountByUsername) {
|
||||||
return badRequest(res, 'Account already exists');
|
return badRequest(res, 'Account already exists.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,11 +53,15 @@ export default async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (req.method === 'DELETE') {
|
if (req.method === 'DELETE') {
|
||||||
|
if (id === userId) {
|
||||||
|
return badRequest(res, 'You cannot delete your own account.');
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
return unauthorized(res);
|
return unauthorized(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
await deleteAccount(userId);
|
await deleteAccount(+id);
|
||||||
|
|
||||||
return ok(res);
|
return ok(res);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user