Merge pull request #3658 from jumpserver/dev_loginip

[Update] 修改获取用户登录的ip和type
pull/3660/head
BaiJiangJie 2020-01-19 12:14:34 +08:00 committed by GitHub
commit 13a042bc0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -111,12 +111,10 @@ def on_audits_log_create(sender, instance=None, **kwargs):
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_ip = request.data.get('remote_addr', '0.0.0.0')
login_type = request.data.get('login_type', '')
login_type = request.META.get('HTTP_X_JMS_LOGIN_TYPE', '')
else:
login_ip = get_request_ip(request) or '0.0.0.0'
login_type = 'W'
data = {