From 98ac06bdd27040220d96a7cba6f59d716261f8ff Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 5 Mar 2014 12:05:51 -0300 Subject: [PATCH] function to get the token, checking if it is valid (which I still need to think about) --- models/.index.js.swp | Bin 12288 -> 0 bytes models/users.js | 5 +++++ 2 files changed, 5 insertions(+) delete mode 100644 models/.index.js.swp diff --git a/models/.index.js.swp b/models/.index.js.swp deleted file mode 100644 index 4dabc8a173c202d8e31f2ca0f21738dd2ffc8443..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2Pixdb7{;gG)V4|my-q7M32w8s3iS_r^x&cPup1Bl>3#4q4Y@neWr@#r&2cDJokDR?QofrlhB@4WBx{&p@)rnPwY<_cf-FEd=H z8H<83 z{f_x(5(*#!MBwlQ@+?}oGQ}<}U0k$_&(F>BGc$J%pNCcu0U|&IhyW2F0z`la5CI}^ zWC>)w3HBK7k5wJaRriT~_v)2yM1Tko0U|&IhyW2F0z`la5CI}U1c<;9Bp^b3_Mc?z zJ!HTC5C8vvJ;m4;=pFP5T7xb?C!k-`jQxZ@KyRSu&@<>M^aN@{E6_A_9QrZE*jwl| z^b&djtwGDsS!f2Dh9;r!@bL}$H1u=?nUZB9Km>>Y5g-CYfCvx)B0vQGAAv!Qhb`|q zL?+#;w2HXvj7A-<^xhR7-(jn*jtnw?L-vhb=0{0-Lj-L%!rA9c zCE6Vou+bc4O9SKLzP8ojwTQGWbG{|g@)g6Q_I%Z~ZMi*>wf#<_w7b3@s?;v8@kqte zD_Z;0LNRBnqjr%#m06x@?%D~zIF`K{xsLC6e74cxiyoh!FDHw4XLxYisq(8hlj*p_ zae66y5Jt@d zgq9D+TflWfk%^Wth~!RgWWfQ?I*;R8g*t43WpOq5&cLEA_k$g3@Dy7}rP6iELC32h zpsc5`C<@BC_$k=ICuk+ht cLt;0=evrj|9;Hclmys|D@~+gGuse|b2JZ4c$N&HU diff --git a/models/users.js b/models/users.js index fa59a7a..dd2f61a 100644 --- a/models/users.js +++ b/models/users.js @@ -6,6 +6,11 @@ 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 + } + } } });