email: user.email,
id: user.id,
notify: user.notify,
+ newsRead: user.newsRead
});
};
- const anonymous = {name:"", email:"", id:0, notify:false};
+ const anonymous = {
+ name: "",
+ email: "",
+ id: 0,
+ notify: false,
+ newsRead: 0
+ };
if (!req.cookies.token)
callback(anonymous);
else if (req.cookies.token.match(/^[a-z0-9]+$/))
}
});
+// Special route to update newsRead timestamp:
+router.put('/newsread', access.logged, access.ajax, (req,res) => {
+ UserModel.setNewsRead(req.userId);
+ res.json({});
+});
+
// Authentication-related methods:
// to: object user (to who we send an email)