From 9a0505f782dee6675b9f820593c10ca0eb3d63dd Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 5 Oct 2015 22:42:42 -0700 Subject: [PATCH] add github linking enforcement --- server/boot/user.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/server/boot/user.js b/server/boot/user.js index 9ecbe288dd..fa529cdd62 100644 --- a/server/boot/user.js +++ b/server/boot/user.js @@ -274,23 +274,32 @@ module.exports = function(app) { }); return res.redirect('/'); } + if (!user.isGithubCool) { + req.flash('errors', { + msg: dedent` + This user needs to link GitHub with their account + in order to display this certificate to the public. + ` + }); + return res.redirect('back'); + } if (user.isLocked) { req.flash('errors', { msg: dedent` - Looks like user '${username}'s account is locked - down to the public. + ${username} has chosen to hide their work from the public. + They need to unhide their work in order for this certificate to + be verifiable. ` }); - return res.redirect('/'); + return res.redirect('back'); } if (!user.isHonest) { req.flash('errors', { msg: dedent` - Looks like the user '${username}'s has not signed - the academic honesty pledge. + ${username} has not agreed to our Academic Honesty Pledge yet. ` }); - return res.redirect('/'); + return res.redirect('back'); } if (