Browse Source

and that's how we do things in js

master
Julio Biason 11 years ago
parent
commit
04b57153cb
  1. 9
      models/users.js

9
models/users.js

@ -6,9 +6,12 @@ module.exports = function(sequelize, DataTypes) {
issuedDate: DataTypes.DATE // since tokens are one way only, we need to make sure the token is valid for today
}, {
classMethods: {
userToken: function (reqToken) {
User.find({ token: reqToken }, success: function (user) {
// validade issuedDate
userToken: function (reqToken, next) {
User.find({ token: reqToken }).success(user) {
// check if the token is valid for today
if (next) {
next (user);
}
}
}
}

Loading…
Cancel
Save