checkNameEmail: function(o)
{
return (
- (!o.name || o.name.match(/^[\w]+$/)) &&
- (!o.email || o.email.match(/^[\w.+-]+@[\w.+-]+$/))
+ (!o.name || !!(o.name.match(/^[\w-]+$/))) &&
+ (!o.email || !!(o.email.match(/^[\w.+-]+@[\w.+-]+$/)))
);
},
});
},
+ setNewsRead: function(uid)
+ {
+ db.serialize(function() {
+ const query =
+ "UPDATE Users " +
+ "SET newsRead = " + Date.now() + " " +
+ "WHERE id = " + uid;
+ db.run(query);
+ });
+ },
+
// Set session token only if empty (first login)
// NOTE: weaker security (but avoid to re-login everywhere after each logout)
// TODO: option would be to reset all tokens periodically, e.g. every 3 months
notify: function(user, message)
{
const subject = "vchess.club - notification";
- const body = "Hello " + user.name + "!" + `
+ const body = "Hello " + user.name + " !" + `
` + message;
sendEmail(params.mail.noreply, user.email, subject, body);
},