fix bug when Empty username is given to LoginAttempt.attempt
This commit is contained in:
parent
33431ae013
commit
5f3ab49535
|
@ -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]
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Reference in New Issue