|
|
@ -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
|
|
|
|
issuedDate: DataTypes.DATE // since tokens are one way only, we need to make sure the token is valid for today
|
|
|
|
}, { |
|
|
|
}, { |
|
|
|
classMethods: { |
|
|
|
classMethods: { |
|
|
|
userToken: function (reqToken) { |
|
|
|
userToken: function (reqToken, next) { |
|
|
|
User.find({ token: reqToken }, success: function (user) { |
|
|
|
User.find({ token: reqToken }).success(user) { |
|
|
|
// validade issuedDate
|
|
|
|
// check if the token is valid for today
|
|
|
|
|
|
|
|
if (next) { |
|
|
|
|
|
|
|
next (user); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|