From 93dc91a761035301e20472537db37ccf788d40ae Mon Sep 17 00:00:00 2001 From: tycrek Date: Sat, 24 Dec 2022 21:50:59 -0700 Subject: [PATCH] fix: tested password reset in prod, not working for some reason --- src/auth.ts | 4 +++- src/routers/api.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/auth.ts b/src/auth.ts index 4429ecc..8abc403 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -137,7 +137,9 @@ export const setUserPassword = (unid: string, password: string): Promise = const authData = fs.readJsonSync(authPath) as Users; const userIndex = authData.users.findIndex((user) => user.unid === unid); authData.users[userIndex] = user; - fs.writeJson(authPath, authData, { spaces: '\t' }); + fs.writeJson(authPath, authData, { spaces: '\t' }) + .then(() => resolve(user)) + .catch(reject); }); /** diff --git a/src/routers/api.ts b/src/routers/api.ts index b15bb9d..142f633 100644 --- a/src/routers/api.ts +++ b/src/routers/api.ts @@ -54,7 +54,7 @@ function buildUserRouter() { setUserPassword(id, newPassword) .then(() => res.sendStatus(200)) - .catch(() => res.sendStatus(500)); + .catch((err) => (log.error(err), res.sendStatus(500))); }); // Create a new user