Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
fix account delete bug
Brian Cao3a617b7bfaa4
diff --git a/pages/api/accounts/[id]/index.js b/pages/api/accounts/[id]/index.jsindex ae5fc4344..c5f16d4e1 100644--- a/pages/api/accounts/[id]/index.js+++ b/pages/api/accounts/[id]/index.js@@ -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);}