Fez*_*sta 4 node.js express passport.js
这是我的登录功能atm:
app.post("/login", passport.authenticate("local", {
failureRedirect: "/login?error=1"
}), function (req, res) {
res.redirect(req.body.url || "/");
});
Run Code Online (Sandbox Code Playgroud)
我需要将req.body.url放在failureRedirect网址中,因此它看起来应该像这样:
app.post("/login", passport.authenticate("local", {
failureRedirect: "/login?error=1&url=" + (req.body.url || "/")
}), function (req, res) {
res.redirect(req.body.url || "/");
});
Run Code Online (Sandbox Code Playgroud)
它不起作用,因为req变量仅在...的回调内部初始化post。我该怎么办?
| 归档时间: |
|
| 查看次数: |
5265 次 |
| 最近记录: |