From 28f0030268072821d72aa46768c9bd4724f7452c Mon Sep 17 00:00:00 2001 From: PerpetualCreativity <47309279+PerpetualCreativity@users.noreply.github.com> Date: Mon, 28 Dec 2020 20:17:19 -0800 Subject: [PATCH] hide profile by default for new users under 13 (#328) * fix search * mobile opt + fixes * check for cur pw * quality of life small improvements and bugfixes * bug fixes * added plurality checker and deleted some comments * hide profile * add hideprofile to user schema * remove hcaptcha * hideprofile edits (not done) * edits for year check * hide profile work * remove email validation and forgot password from public access * remove a frontend link * hide stats as well, make that clear on settings * formatting for settings personalization * allow people to see their own stuffs * hide profile by default when user is under 13 Co-authored-by: Michael Co-authored-by: Skippy Co-authored-by: Michael Li <45986807+ML72@users.noreply.github.com> --- routes/public.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) } });