mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Merge remote-tracking branch 'origin/app' into dev
This commit is contained in:
commit
5d73a9c4b4
4 changed files with 70 additions and 9 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export default async (req, res) => {
|
|||
if (req.method === 'POST') {
|
||||
const { name, domain, owner, enableShareUrl, shareId } = req.body;
|
||||
const { accountUuid } = req.auth;
|
||||
|
||||
let account;
|
||||
|
||||
if (accountUuid) {
|
||||
|
|
@ -43,7 +44,7 @@ export default async (req, res) => {
|
|||
name,
|
||||
domain,
|
||||
shareId: shareId ? shareId : newShareId,
|
||||
userId: account ? account.id : +owner || undefined,
|
||||
userId: +owner || account.id,
|
||||
},
|
||||
{ websiteUuid },
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue