Save user IP to database.

This commit is contained in:
Simo Kinnunen
2014-05-30 11:46:29 +09:00
parent 22fc9e79dd
commit 24c1ba1bda
2 changed files with 7 additions and 1 deletions

View File

@@ -11,7 +11,11 @@ module.exports = function(options) {
, redir = urlutil.removeParam(req.url, 'jwt')
if (data) {
// Redirect once to get rid of the token
dbapi.saveUserAfterLogin(data)
dbapi.saveUserAfterLogin({
name: data.name
, email: data.email
, ip: req.ip
})
.then(function() {
req.session.jwt = data
res.redirect(redir)