Private
Public Access
1
0

Checks for users with that email address

This commit is contained in:
Sander Roosendaal
2017-02-10 16:27:19 +01:00
parent 70d4050bc9
commit 288bac995b
2 changed files with 12 additions and 2 deletions

View File

@@ -254,7 +254,7 @@ def handle_sendemail_invite(email,name,code,teamname,manager):
message += 'https://rowsandall.com/rowers/me/invitation/'+code+' \n\n'
message += 'You can also manually accept your team membership with the code.\n'
message += 'You will need to do this if you registered under a differnt email address than this one.\n'
message += 'You will need to do this if you registered under a different email address than this one.\n'
message += 'Code: '+code+'\n'
message += 'Link to manually accept your team membership: '
message += 'https://rowsandall.com/rowers/me/invitation\n\n'

View File

@@ -169,6 +169,12 @@ def create_invite(team,manager,user=None,email=''):
return (0,'Already member of that team')
elif email==None or email=='':
return (0,'Invalid request - missing email or user')
else:
try:
r2 = Rower.objects.get(user__email=email)
user = User.objects.get(rower=r2)
except Rower.DoesNotExist:
user=None
if count_club_members(team.manager)+count_invites(team.manager) < r.clubsize:
codes = [i.code for i in TeamInvite.objects.all()]
@@ -242,7 +248,11 @@ def reject_invitation(user,id):
def send_invite_email(id):
invitation = TeamInvite.objects.get(id=id)
try:
invitation = TeamInvite.objects.get(id=id)
except TeamInvite.DoesNotExist:
return (0,'Invitation doesn not exist')
if invitation.user:
email = invitation.user.email
name = invitation.user.first_name + " " + invitation.user.last_name