aboutsummaryrefslogtreecommitdiffstats
path: root/routes/users.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-03-13 16:08:52 -0700
committerAdam Soltys <[email protected]>2025-03-13 16:08:52 -0700
commit37d4f46c24532150654bc5e14c4cf7b16d822712 (patch)
treec6218b74d63123c5f8e3dbfa37f1cad785fc7f54 /routes/users.ts
parent48001868b418c500d96801bf31b5f7b5c4f4d79c (diff)
downloadcoinos-server-37d4f46c24532150654bc5e14c4cf7b16d822712.tar.gz
coinos-server-37d4f46c24532150654bc5e14c4cf7b16d822712.zip
account check
Diffstat (limited to 'routes/users.ts')
-rw-r--r--routes/users.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/routes/users.ts b/routes/users.ts
index ab8cb61a..8fb078e1 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -769,8 +769,12 @@ export default {
async updateAccount(req, res) {
const { id } = req.params;
+ const { id: uid } = req.user;
const { name } = req.body;
+ const pos = await db.lPos(`${uid}:accounts`, id);
+ if (!pos) fail("account not found");
+
const account = await g(`account:${id}`);
account.name = name;
await s(`account:${id}`, account);
@@ -783,6 +787,10 @@ export default {
const { id } = req.body;
const { id: uid } = req.user;
const { type } = await g(`account:${id}`);
+
+ const pos = await db.lPos(`${uid}:accounts`, id);
+ if (!(type && pos)) fail("account not found");
+
try {
const node = rpc({ ...config[type], wallet: id });
await node.unloadWallet(id);