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