Skip to content

Commit 5cd7163

Browse files
Merge pull request #1482 from IFRCGo/fix/accounts-same-email-1478
Accounts with identical email addresses
2 parents 47e753e + 417ce12 commit 5cd7163

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

api/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,11 @@ def post(self, request):
350350
return bad_request('Body must contain `email/username` and `password`')
351351

352352
user = authenticate(username=username, password=password)
353+
if user == None and User.objects.filter(email=username).count() > 1:
354+
users = User.objects.filter(email=username, is_active=True)
355+
if users:
356+
# We get the first one if there are still multiple available is_active:
357+
user = authenticate(username=users[0].username, password=password)
353358

354359
# Determining the client IP is not always straightforward:
355360
clientIP = ''

0 commit comments

Comments
 (0)