mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-24 22:56:26 -08:00
grahh how am i going to do secondary authenticatino for the delete /user route
This commit is contained in:
parent
cdcc1f0312
commit
c87316cbc7
|
@ -154,15 +154,15 @@ export default function (files: Files) {
|
|||
let acc = ctx.req.param("user") == "me" ? ctx.get("account") : Accounts.getFromId(ctx.req.param("user"))
|
||||
if (acc != ctx.get("account") && !ctx.get("account")?.admin) return ServeError(ctx, 403, "you are not an administrator")
|
||||
if (!acc) return ServeError(ctx, 404, "account does not exist")
|
||||
const Account = ctx.get("account") as Accounts.Account
|
||||
const accountId = Account.id
|
||||
|
||||
auth.AuthTokens.filter((e) => e.account == accountId).forEach(
|
||||
auth.AuthTokens.filter((e) => e.account == acc?.id).forEach(
|
||||
(token) => {
|
||||
auth.invalidate(token.token)
|
||||
}
|
||||
)
|
||||
|
||||
await Accounts.deleteAccount(acc.id)
|
||||
|
||||
if (acc.email) {
|
||||
await sendMail(
|
||||
acc.email,
|
||||
|
@ -174,7 +174,6 @@ export default function (files: Files) {
|
|||
return ctx.text("OK")
|
||||
}
|
||||
|
||||
await Accounts.deleteAccount(accountId)
|
||||
return ctx.text("account deleted")
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue