fix bug when Empty username is given to LoginAttempt.attempt

This commit is contained in:
Jens Langhammer
2019-02-25 14:10:29 +01:00
parent 33431ae013
commit 5f3ab49535
2 changed files with 3 additions and 1 deletions

View File

@ -84,6 +84,8 @@ class LoginAttempt(CreatedUpdatedModel):
@staticmethod
def attempt(target_uid, request):
"""Helper function to create attempt or count up existing one"""
if not target_uid:
return
client_ip, _ = get_client_ip(request)
# Since we can only use 254 chars for target_uid, truncate target_uid.
target_uid = target_uid[:254]