diff options
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.js | 12 | ||||
| -rw-r--r-- | routes/users.js | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/routes/payments.js b/routes/payments.js index 37f4c953..1043959c 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -240,19 +240,19 @@ export default { res.send({ txid }); }, - async del({ params: { username }, headers: { authorization }}, res) { -if (!authorization.includes(config.admin)) return res.code(401).send("unauthorized") + async del({ params: { username }, headers: { authorization } }, res) { + if (!authorization.includes(config.admin)) + return res.code(401).send("unauthorized"); let { id, pubkey } = await g(`user:${await g(`user:${username}`)}`); let invoices = await db.lRange(`${id}:invoices`, 0, -1); let payments = await db.lRange(`${id}:payments`, 0, -1); - for (let {id} of invoices) db.del(`invoice:${id}`); - for (let {id} of payments) db.del(`payment:${id}`); + for (let { id } of invoices) db.del(`invoice:${id}`); + for (let { id } of payments) db.del(`payment:${id}`); db.del(`user:${username}`); db.del(`user:${id}`); db.del(`user:${pubkey}`); res.send({}); - } + } }; - diff --git a/routes/users.js b/routes/users.js index 4fcc50df..17d4e1da 100644 --- a/routes/users.js +++ b/routes/users.js @@ -134,7 +134,7 @@ export default { if (user.pin && !(pin === user.pin)) throw new Error("Pin required"); if (typeof newpin !== "undefined") user.pin = newpin; - if (!user.pin) user.pin = null; + if (!user.pin || user.pin === "undefined") delete user.pin; let exists; if (username) exists = await g(`user:${username}`); @@ -237,7 +237,7 @@ export default { if (!p.with) continue; let id = await g(`user:${p.with.username}`); - let u = id && await g(`user:${id}`); + let u = id && (await g(`user:${id}`)); if (!u) { u = await got(`${classic}/admin/migrate/${p.with.username}`, { |
