UPDATE: Just an FYI, I rebuilt this app locally and it works. Obviously, FCC tests can’t reach my localhost, but at least the code proves correct.
My console does output:
User freeCodeCampTester attempted to log in
but I can’t seem to get the login form to work regardless of the fcc tests failing.
If I console log the req.user
object it shows:
{ _id: 5d53ca9af675a32ed41adb4a,
username: 'freeCodeCampTester',
password: 'freeCodeCampTester' }
my /login route code is:
app.route('/login')
.post(passport.authenticate('local',{ failureRedirect: '/' }), (req, res) => {
console.log(req.user)
res.redirect('/profile');
});
Any idea why the res.redirect('/profile');
is not working?
.