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 @staticmethod
def attempt(target_uid, request): def attempt(target_uid, request):
"""Helper function to create attempt or count up existing one""" """Helper function to create attempt or count up existing one"""
if not target_uid:
return
client_ip, _ = get_client_ip(request) client_ip, _ = get_client_ip(request)
# Since we can only use 254 chars for target_uid, truncate target_uid. # Since we can only use 254 chars for target_uid, truncate target_uid.
target_uid = target_uid[:254] target_uid = target_uid[:254]

View File

@ -1,6 +1,6 @@
{% if messages %} {% if messages %}
{% for msg in messages %} {% for msg in messages %}
<div class="alert alert-{{ msg.level_tag }}"> <div class="{% if toast %}toast-pf{% endif %} alert alert-{{ msg.level_tag }}">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span class="pficon pficon-close"></span> <span class="pficon pficon-close"></span>
</button> </button>