diff --git a/.gitignore b/.gitignore index ba08eb7..a6054e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ node_modules -efault.js +default.js diff --git a/api/controller/officer.Controller.js b/api/controller/officer.Controller.js index 8e09f54..7d2a1f2 100644 --- a/api/controller/officer.Controller.js +++ b/api/controller/officer.Controller.js @@ -238,11 +238,20 @@ const officerActions = ( */ const resetPassword = async (req, res) => { try { + const { password } = req.body + + if(!password) return res.json({ + status: "password not changed", + msg: "Please provide a new password" + }) const officer = await Officers.findOneAndUpdate( { _id: req.params.officerID }, req.body.password ); - res.json(officer); + res.json({ + msg: "your password change was successful", + officer + }); } catch (err) { res.status(500).json(err); } diff --git a/config/default.js b/config/default.js deleted file mode 100644 index 3c9716f..0000000 --- a/config/default.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - MONGO_URI: - "mongodb+srv://criminalRecord:bz49cRMd5VUq6OyV@criminal-registry-api-c.a3vdg.mongodb.net/criminalRecord?retryWrites=true&w=majority", - MONGO_DB: "mongodb://localhost:27017/criminal-registry-API", - mySecrete: "Brilliant Bright", - PORT: process.env.PORT || 3000, - url: "http://localhost", -};