node.js - how to visualize message in passport.js during local strategy configuration -
i don't know how visualize message in passport.js. when run app.js, no message pop out. after check documents, middleware "connect-flash" need required, need use req.flash , res.locals. don't know how configure it, can help? new in node.js , express.
app.use(require('connect-flash')()); passport.use(new strategy( function (username, password, cb) { db.users.findbyusername(username, function (err, user) { if (err) { return cb(err); } if (!user) { return cb(null, false, { message: 'incorrect username.' }); } // how visualize message? if (user.password != password) { return cb(null, false, { message: 'incorrect userpassword.' }); } //how visualize message? return cb(null, user); }); }));
Comments
Post a Comment