Tag: 本地护照

未定义的消息variablesNodeJS

我一直在遵循本教程为我的节点应用程序来实现身份validation: https : //scotch.io/tutorials/easy-node-authentication-setup-and-local 我遇到的问题是我运行应用程序时出现此错误:(我的代码是exacltly应该如何根据上述网站)。 我试图寻找一个答案,但我可以得到的最好的是添加这个函数到我的服务器代码: app.use(function(req, res, next){ res.locals.message = req.flash(); next(); }); 这加载应用程序没有任何错误,但是,消息似乎并没有显示在我的前端。 不完全确定为什么,但林只能得到这个问题,我可以实现消息没有任何问题在我的其他项目。 我已经在下面添加了我的github链接,但是我的代码里有一些我的代码: routes.js app.post('/signup', passport.authenticate('local-signup', { successRedirect : '/dashboard', failureRedirect : '/#contact', failureFlash : true })); passport.js if (user) { return done(null, false, req.flash('signupMessage', 'Email already in use!')); } index.ejs <% if (message.length > 0) { %> <div class="alert alert-danger"><%= […]