2
我在我的應用程序中實施了護照本地策略。現在,我要實現我的記憶功能:passport.js:記住我沒有在快遞應用程序中工作
app.use(passport.initialize());
app.use(passport.session());
app.post("/login", function (req, res, next) {
var authFunction = passport.authenticate("local", function (err, user, info) {
if (err) {
next(err);
} else {
req.logIn(user, function (err) {
if (err) {
next(err);
} else {
if (req.body.remember) {
req.session.cookie.originalMaxAge = 2592000000;
} else {
req.session.cookie._expires = false;
}
res.redirect("/");
}
});
}
});
authFunction(req, res, next);
});
正如你可以看到我設置originalMaxAge
,但是當我關閉並重新打開瀏覽器就不能正常工作。
有什麼想法?