Skip to content

Commit

Permalink
Added Logout button
Browse files Browse the repository at this point in the history
  • Loading branch information
rmaharja committed Oct 15, 2018
1 parent 119ff74 commit 97385ae
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 125 deletions.
2 changes: 2 additions & 0 deletions config/passport.js
Expand Up @@ -21,7 +21,9 @@ passport.use(new LocalStrategy(
if (!dbUser) {
return done(null, false, {
message: "Incorrect email."

});

}
else if (!dbUser.validPassword(password)) {
return done(null, false, {
Expand Down
7 changes: 6 additions & 1 deletion controllers/profController.js
@@ -1,4 +1,4 @@
var db = require("../models");
var db = require("../models");
var passport = require("../config/passport");
const Sequelize = require("sequelize");
const Op = Sequelize.Op;
Expand All @@ -13,6 +13,11 @@ module.exports = function (app) {
res.render("login");
});

app.get("/logout", function(req, res) {
req.logout();
res.redirect("/");
});

app.post("/", passport.authenticate("local"),
function (req, res) {
res.json("/prof-finder")
Expand Down

0 comments on commit 97385ae

Please sign in to comment.