Don't require the invite email to match the invited user
This commit is contained in:
parent
4a2a4d1b4c
commit
fa1abd5eda
1 changed files with 8 additions and 13 deletions
|
@ -1921,25 +1921,19 @@ def confirm_email_authorization_for_repo(code):
|
||||||
def lookup_team_invites(user):
|
def lookup_team_invites(user):
|
||||||
return TeamMemberInvite.select().where(TeamMemberInvite.user == 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.
|
# Lookup the invite code.
|
||||||
try:
|
try:
|
||||||
found = TeamMemberInvite.get(TeamMemberInvite.invite_token == code)
|
found = TeamMemberInvite.get(TeamMemberInvite.invite_token == code)
|
||||||
except TeamMemberInvite.DoesNotExist:
|
except TeamMemberInvite.DoesNotExist:
|
||||||
raise DataModelException('Invalid confirmation code.')
|
raise DataModelException('Invalid confirmation code.')
|
||||||
|
|
||||||
# Verify the code applies to the current user.
|
if user and found.user != user:
|
||||||
if found.user:
|
|
||||||
if found.user != user:
|
|
||||||
raise DataModelException('Invalid confirmation code.')
|
|
||||||
else:
|
|
||||||
if found.email != user.email:
|
|
||||||
raise DataModelException('Invalid confirmation code.')
|
raise DataModelException('Invalid confirmation code.')
|
||||||
|
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
def delete_team_invite(code, user=None):
|
||||||
def delete_team_invite(code, user):
|
|
||||||
found = lookup_team_invite(code, user)
|
found = lookup_team_invite(code, user)
|
||||||
|
|
||||||
team = found.team
|
team = found.team
|
||||||
|
@ -1949,8 +1943,9 @@ def delete_team_invite(code, user):
|
||||||
|
|
||||||
return (team, inviter)
|
return (team, inviter)
|
||||||
|
|
||||||
|
|
||||||
def confirm_team_invite(code, user):
|
def confirm_team_invite(code, user):
|
||||||
found = lookup_team_invite(code, user)
|
found = lookup_team_invite(code)
|
||||||
|
|
||||||
# Add the user to the team.
|
# Add the user to the team.
|
||||||
try:
|
try:
|
||||||
|
|
Reference in a new issue