mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Attempt to fix the logging middleware again
This commit is contained in:
@@ -46,7 +46,11 @@ class IPTrackingMiddleware(object):
|
||||
def process_request(self, request):
|
||||
|
||||
if request.user and not request.user.is_anonymous():
|
||||
try:
|
||||
ip, created = SSOUserIPAddress.objects.get_or_create(user=request.user, ip_address=request.META['REMOTE_ADDR'])
|
||||
except IntegrityError:
|
||||
ip = SSOUserIPAddress.objects.get(user=request.user, ip_address=request.META['REMOTE_ADDR'])
|
||||
created = False
|
||||
if not created:
|
||||
ip.last_seen = datetime.utcnow()
|
||||
ip.save()
|
||||
|
||||
Reference in New Issue
Block a user