From fa1abd5edaaf6f4327a8fde4adb62384b795ddbc Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 4 Sep 2014 18:42:23 -0400 Subject: [PATCH] Don't require the invite email to match the invited user --- data/model/legacy.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/data/model/legacy.py b/data/model/legacy.py index cad0b592d..4b97a8e7c 100644 --- a/data/model/legacy.py +++ b/data/model/legacy.py @@ -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: - raise DataModelException('Invalid confirmation code.') - + 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: @@ -1958,7 +1953,7 @@ def confirm_team_invite(code, user): except UserAlreadyInTeam: # Ignore. pass - + # Delete the invite and return the team. team = found.team inviter = found.inviter