Don't require the invite email to match the invited user

This commit is contained in:
Joseph Schorr 2014-09-04 18:42:23 -04:00
parent 4a2a4d1b4c
commit fa1abd5eda

View file

@ -1921,25 +1921,19 @@ def confirm_email_authorization_for_repo(code):
def lookup_team_invites(user):
return TeamMemberInvite.select().where(TeamMemberInvite.user == user)
def lookup_team_invite(code, user):
def lookup_team_invite(code, user=None):
# Lookup the invite code.
try:
found = TeamMemberInvite.get(TeamMemberInvite.invite_token == code)
except TeamMemberInvite.DoesNotExist:
raise DataModelException('Invalid confirmation code.')
# Verify the code applies to the current user.
if found.user:
if found.user != user:
raise DataModelException('Invalid confirmation code.')
else:
if found.email != user.email:
if user and found.user != user:
raise DataModelException('Invalid confirmation code.')
return found
def delete_team_invite(code, user):
def delete_team_invite(code, user=None):
found = lookup_team_invite(code, user)
team = found.team
@ -1949,8 +1943,9 @@ def delete_team_invite(code, user):
return (team, inviter)
def confirm_team_invite(code, user):
found = lookup_team_invite(code, user)
found = lookup_team_invite(code)
# Add the user to the team.
try: