Skip to content

Instantly share code, notes, and snippets.

@mmirolim
Created June 30, 2014 18:23
Show Gist options
  • Save mmirolim/18323d6ab2fd1f4f4dc3 to your computer and use it in GitHub Desktop.
Save mmirolim/18323d6ab2fd1f4f4dc3 to your computer and use it in GitHub Desktop.
Private channel static for a day
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