diff --git a/routes/public.js b/routes/public.js index d07b2f49..32c767b9 100644 --- a/routes/public.js +++ b/routes/public.js @@ -127,7 +127,7 @@ module.exports = (app, mongo) => { req.flash('errorFlash', 'You must be at least 13 years old, or have permission from your parent, guardian, teacher, or school to use Mutorials.'); registerInputProblems1 = true; } - + if (!(/^(19|20)\d{2}$/.test(req.body.yob)) || req.body.yob.length != 4 || req.body.yob > new Date().getFullYear()) { req.flash('errorFlash', 'Please enter a valid year of birth!'); registerInputProblems1 = true; @@ -174,6 +174,9 @@ module.exports = (app, mongo) => { physics: -1, chemistry: -1, biology: -1 + }, + preferences: { + hideProfile: ((new Date().getFullYear() - thisYob)<13 ? true : false) } });