From b06cddd2c261b7d932c1972e78fb6c10eba0df22 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sat, 10 Oct 2020 09:33:43 +0200 Subject: [PATCH] fix emailprocessing bug --- rowers/views/workoutviews.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 46ef01fc..71d6a4cf 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -4632,7 +4632,7 @@ def workout_upload_api(request): q = request.POST post_data = {k: q.getlist(k) if len(q.getlist(k))>1 else v for k, v in q.items()} - + # only allow local host hostt = request.get_host().split(':') if hostt[0] not in ['localhost','127.0.0.1','dev.rowsandall.com','rowsandall.com']: @@ -4697,9 +4697,10 @@ def workout_upload_api(request): else: r = None for rwr in Rower.objects.all(): - if post_data['useremail'] in rwr.emailalternatives: - r = rwr - break + if rwr.emailalternatives is not None: + if post_data['useremail'] in rwr.emailalternatives: + r = rwr + break if post_data['useremail'] not in r.emailalternatives: message = {'status':'false','message':'could not find user'} return JSONResponse(status=400,data=message)