1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

Fix tests

This commit is contained in:
zhengxie
2016-06-27 13:43:45 +08:00
parent 3259a9255c
commit 421725c4c8
2 changed files with 5 additions and 4 deletions

View File

@@ -47,7 +47,7 @@ def log_user_in(request, user, redirect_to):
if request.session.test_cookie_worked():
request.session.delete_test_cookie()
_clear_login_failed_attempts(request)
_clear_login_failed_attempts(request, user)
if two_factor_auth_enabled(user):
return handle_two_factor_auth(request, user, redirect_to)
@@ -105,14 +105,15 @@ def _incr_login_failed_attempts(username=None, ip=None):
return max(username_attempts, ip_attempts)
def _clear_login_failed_attempts(request):
def _clear_login_failed_attempts(request, user):
"""Clear login failed attempts records.
Arguments:
- `request`:
"""
username = request.user.username
username = user.username
ip = get_remote_ip(request)
cache.delete(LOGIN_ATTEMPT_PREFIX + urlquote(username))
cache.delete(LOGIN_ATTEMPT_PREFIX + ip)
p = Profile.objects.get_profile_by_user(username)

View File

@@ -1,4 +1,4 @@
{% extends "admin_base.html" %}
{% extends "sysadmin/base.html" %}
{% load i18n seahub_tags %}
{% block nav_orgadmin_class %}class="cur"{% endblock %}