mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Merge pull request #1627 from umami-software/bug/um-92-delete-account
fix account delete bug
This commit is contained in:
commit
1c69577683
1 changed files with 6 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ export default async (req, res) => {
|
|||
const accountByUsername = await getAccount({ username });
|
||||
|
||||
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 (id === userId) {
|
||||
return badRequest(res, 'You cannot delete your own account.');
|
||||
}
|
||||
|
||||
if (!isAdmin) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
await deleteAccount(userId);
|
||||
await deleteAccount(+id);
|
||||
|
||||
return ok(res);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue