Created
May 3, 2011 14:36
-
-
Save luccastera/953434 to your computer and use it in GitHub Desktop.
"Can't set headers after they are sent." example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/recover_password', function(req, res) { | |
User.get(req.body.username, function(err,data) { | |
if (err) { | |
req.session.error = 'We could not find this user.'; | |
res.redirect('back'); // ERROR THROWN HERE | |
} else { | |
var user = new User(data); | |
user.resetPassword(function(err,data) { | |
var newUser = new User(data); | |
newUser.sendPasswordRecoveryEmail(); | |
}); | |
res.redirect('/recover_password_confirmation'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you solve this? I'm having the exact same problem.