From e24f0453bb4a0dd57a7598098aaa412f16224812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksi=20Ha=CC=88kli?= Date: Wed, 13 Mar 2019 15:49:51 +0200 Subject: [PATCH] Remove reduntant AccessLog.trusted flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All attempts that are logged are marked as trusted and no other attempts are created in the code, so having a flag that also uses a database index is redundant and unnecessary. Signed-off-by: Aleksi Häkli --- axes/admin.py | 1 - axes/handlers/database.py | 1 - .../migrations/0006_remove_accesslog_trusted.py | 17 +++++++++++++++++ axes/models.py | 7 ------- 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 axes/migrations/0006_remove_accesslog_trusted.py diff --git a/axes/admin.py b/axes/admin.py index 41ec3e2..e8f0209 100644 --- a/axes/admin.py +++ b/axes/admin.py @@ -96,7 +96,6 @@ class AccessLogAdmin(admin.ModelAdmin): 'user_agent', 'ip_address', 'username', - 'trusted', 'http_accept', 'path_info', 'attempt_time', diff --git a/axes/handlers/database.py b/axes/handlers/database.py index 26af79f..30e46a6 100644 --- a/axes/handlers/database.py +++ b/axes/handlers/database.py @@ -155,7 +155,6 @@ class AxesDatabaseHandler(AxesBaseHandler): # pylint: disable=too-many-locals http_accept=request.axes_http_accept, path_info=request.axes_path_info, attempt_time=request.axes_attempt_time, - trusted=True, ) if settings.AXES_RESET_ON_SUCCESS: diff --git a/axes/migrations/0006_remove_accesslog_trusted.py b/axes/migrations/0006_remove_accesslog_trusted.py new file mode 100644 index 0000000..756522b --- /dev/null +++ b/axes/migrations/0006_remove_accesslog_trusted.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0.4 on 2019-03-13 08:55 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('axes', '0005_remove_accessattempt_trusted'), + ] + + operations = [ + migrations.RemoveField( + model_name='accesslog', + name='trusted', + ), + ] diff --git a/axes/models.py b/axes/models.py index d94278a..8bf1dc4 100644 --- a/axes/models.py +++ b/axes/models.py @@ -65,13 +65,6 @@ class AccessAttempt(AccessBase): class AccessLog(AccessBase): - # Once a user logs in from an ip, that combination is trusted and not - # locked out in case of a distributed attack - trusted = models.BooleanField( - default=False, - db_index=True, - ) - logout_time = models.DateTimeField( _('Logout Time'), null=True,