aboutsummaryrefslogtreecommitdiffstats
path: root/routes/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/users.js')
-rw-r--r--routes/users.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/routes/users.js b/routes/users.js
index d6199cb7..e7aec50e 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -507,6 +507,12 @@ app.post(
} = req.body;
try {
+ let account = await db.Account.findOne({
+ where: { id, user_id: user.id }
+ });
+
+ if (!account || (account.pubkey && !pubkey)) throw new Error("Problem updating account");
+
await db.Account.update(
{
name,
@@ -525,7 +531,7 @@ app.post(
}
);
- const account = await db.Account.findOne({
+ account = await db.Account.findOne({
where: { id }
});