Skip to content

Commit

Permalink
Merge pull request hng-tech#35 from IDTitanium/master
Browse files Browse the repository at this point in the history
Fixed Admin Login
  • Loading branch information
prismaticoder committed Apr 15, 2019
2 parents 1c4bc0a + 7bc5bbb commit 5b7bdec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion models/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const AdminSchema = new mongoose.Schema({


AdminSchema.statics.authenticate = function (username, password, callback) {
Admin.findOne({ username: username })
Admin.findOne({ username: username,
password: password
})
.exec(function (err, admin) {
if (err) {
return callback(err)
Expand Down
3 changes: 1 addition & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ router.get('/managejobs', function (req, res, next) {
res.redirect("/admin");
// return next(err);
} else {
return res.render("manage_jobs");
return next();
}
}
});
Expand All @@ -66,7 +66,6 @@ router.get("/faqs", Home.faqs);
router.get("/job_details", Home.job_details);

//Job Routes
router.get("/jobs", Jobs.get_all);
router.get("/jobs_json", Jobs.get_all_json);
router.get("/jobs_json/:job_id", Jobs.get_one_json);
router.get("/jobs_api", Jobs.fetchData);
Expand Down

0 comments on commit 5b7bdec

Please sign in to comment.