0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/models/base/events.js

18 lines
581 B
JavaScript
Raw Normal View History

var config = require('../../config'),
moment = require('moment'),
events = require(config.paths.corePath + '/server/events'),
models = require(config.paths.corePath + '/server/models'),
errors = require(config.paths.corePath + '/server/errors');
/**
* WHEN access token is created we will update last_login for user.
*/
events.on('token.added', function (tokenModel) {
models.User.edit(
{last_login: moment().utc()}, {id: tokenModel.get('user_id')}
)
.catch(function (err) {
errors.logError(err);
});
});