Skip to content

Commit

Permalink
无用包移除,额外信息移除ua
Browse files Browse the repository at this point in the history
  • Loading branch information
weideguo committed Jan 19, 2022
1 parent 14621ac commit d7f2a9c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sql/audit_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import logging
import datetime
import simplejson as json
import geolite2
import maxminddb

from django.dispatch import receiver
from django.utils import timezone
Expand Down Expand Up @@ -86,9 +84,8 @@ def get_client_ip(request):
@receiver(user_logged_in)
def user_logged_in_callback(sender, request, user, **kwargs):
ip = get_client_ip(request)
ua = request.META.get('HTTP_USER_AGENT', 'unknown')
now = timezone.now()
AuditEntry.objects.create(action=u'登入', extra_info='|'.join([ip,ua]), user_id=user.id, user_name=user.username, user_display=user.display, action_time=now)
AuditEntry.objects.create(action=u'登入', extra_info=ip, user_id=user.id, user_name=user.username, user_display=user.display, action_time=now)


@receiver(user_logged_out)
Expand Down

0 comments on commit d7f2a9c

Please sign in to comment.