diff --git a/apps/audits/migrations/0012_auto_20210414_1443.py b/apps/audits/migrations/0012_auto_20210414_1443.py new file mode 100644 index 000000000..39a8ac52c --- /dev/null +++ b/apps/audits/migrations/0012_auto_20210414_1443.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1 on 2021-04-14 06:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('audits', '0011_userloginlog_backend'), + ] + + operations = [ + migrations.AlterField( + model_name='userloginlog', + name='type', + field=models.CharField(choices=[('W', 'Web'), ('T', 'Terminal'), ('U', 'Unknown')], max_length=2, verbose_name='Login type'), + ), + ] diff --git a/apps/audits/models.py b/apps/audits/models.py index 9a1f64e60..aab3bbde9 100644 --- a/apps/audits/models.py +++ b/apps/audits/models.py @@ -79,6 +79,7 @@ class UserLoginLog(models.Model): LOGIN_TYPE_CHOICE = ( ('W', 'Web'), ('T', 'Terminal'), + ('U', 'Unknown'), ) MFA_DISABLED = 0 diff --git a/apps/audits/signals_handler.py b/apps/audits/signals_handler.py index c604e9b6b..853030287 100644 --- a/apps/audits/signals_handler.py +++ b/apps/audits/signals_handler.py @@ -146,7 +146,7 @@ def generate_data(username, request): user_agent = request.META.get('HTTP_USER_AGENT', '') login_ip = get_request_ip(request) or '0.0.0.0' if isinstance(request, Request): - login_type = request.META.get('HTTP_X_JMS_LOGIN_TYPE', '') + login_type = request.META.get('HTTP_X_JMS_LOGIN_TYPE', 'U') else: login_type = 'W'