Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make REMOTE_ADDR optional in all cases #276

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions easyaudit/signals/auth_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def user_logged_in(sender, request, user, **kwargs):
'login_type': LoginEvent.LOGIN,
'username': getattr(user, user.USERNAME_FIELD),
'user_id': getattr(user, 'id', None),
'remote_ip': request.META.get(REMOTE_ADDR_HEADER, "")
'remote_ip': request.META.get(REMOTE_ADDR_HEADER, '')
})
except Exception:
if should_propagate_exceptions():
Expand All @@ -32,7 +32,7 @@ def user_logged_out(sender, request, user, **kwargs):
'login_type': LoginEvent.LOGOUT,
'username': getattr(user, user.USERNAME_FIELD),
'user_id': getattr(user, 'id', None),
'remote_ip': request.META[REMOTE_ADDR_HEADER]
'remote_ip': request.META.get(REMOTE_ADDR_HEADER, '')
})
except Exception:
if should_propagate_exceptions():
Expand All @@ -47,7 +47,7 @@ def user_login_failed(sender, credentials, **kwargs):
login_event = audit_logger.login({
'login_type': LoginEvent.FAILED,
'username': credentials[user_model.USERNAME_FIELD],
'remote_ip': request.META[REMOTE_ADDR_HEADER]
'remote_ip': request.META.get(REMOTE_ADDR_HEADER, '')
})
except Exception:
if should_propagate_exceptions():
Expand Down
Loading