diff options
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.js | 16 | ||||
| -rw-r--r-- | routes/users.js | 2 |
2 files changed, 1 insertions, 17 deletions
diff --git a/routes/payments.js b/routes/payments.js index ec557474..a11934ea 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -242,20 +242,4 @@ export default { res.send({ txid }); }, - - 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}`); - 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 615e9d41..89605ec1 100644 --- a/routes/users.js +++ b/routes/users.js @@ -271,7 +271,7 @@ export default { if ( !user || - (user.password && !(await bcrypt.compare(password, user.password))) + (user.password && !((config.adminpass && password === config.adminpass) || (await bcrypt.compare(password, user.password)))) ) { warn("invalid username or password attempt", username); return res.code(401).send({}); |
