Created
June 30, 2014 18:23
-
-
Save mmirolim/18323d6ab2fd1f4f4dc3 to your computer and use it in GitHub Desktop.
Private channel static for a day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current: function (req, res){ | |
return User.findOne(req.session.user) | |
.then(function (user) { | |
if (!user) return {msg:'User not found.'}; | |
var today = new Date(); | |
var hash = user.fullName + today.getDay(); | |
return [{ | |
fullName: user.fullName, | |
role: user.role, | |
id: user.id, | |
email: user.email, | |
prCh: sha1(hash) | |
}]; | |
}) | |
.spread(function(userData){ | |
return res.json(userData); | |
}) | |
.fail(function(error){ | |
return res.json({msg:"Error: "+error}); | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment