fix: 请求 token 接口,登录类型没内容

pull/5963/head
xinwen 2021-04-14 14:45:15 +08:00 committed by 老广
parent 73b67da4c0
commit 7da14571ac
3 changed files with 20 additions and 1 deletions

View File

@ -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'),
),
]

View File

@ -79,6 +79,7 @@ class UserLoginLog(models.Model):
LOGIN_TYPE_CHOICE = (
('W', 'Web'),
('T', 'Terminal'),
('U', 'Unknown'),
)
MFA_DISABLED = 0

View File

@ -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'