If user tries to invite themselves to project, don't.

This commit is contained in:
Shane Kilkelly
2017-01-16 13:45:01 +00:00
parent 962a4d5039
commit 82ddeab2bd
3 changed files with 36 additions and 0 deletions
@@ -37,6 +37,9 @@ module.exports = CollaboratorsInviteController =
email = req.body.email
sendingUser = AuthenticationController.getSessionUser(req)
sendingUserId = sendingUser._id
if email == sendingUser.email
logger.log {projectId, email, sendingUserId}, "cannot invite yourself to project"
return res.json {invite: null, error: 'cannot_invite_self'}
logger.log {projectId, email, sendingUserId}, "inviting to project"
LimitationsManager.canAddXCollaborators projectId, 1, (error, allowed) =>
return next(error) if error?