I am using a .js passport with a local authentication strategy for my node.js / express application.
The user returned by LocalStrategy includes things such as email and username.
I want to give users the opportunity to update their email or username in the application. When this happens, I would like to inform the passport in order to restart the user (it seems as if they had just logged in), so that req.user reflects the updated changes in the remainder of the session. Just setting this up didn't seem to last in the last request.
A simplified example:
app.get('/changeEmail', function(req, res, next) { var userId = req.user.id; var origEmail = req.user.email; var newEmail = req.param('email'); userDao.updateEmail(userId, newEmail, function(err) { if (!err) {
Zugwalt
source share