Skip to content

Commit

Permalink
fix(api): remote ip for login log
Browse files Browse the repository at this point in the history
  • Loading branch information
pycook committed Sep 10, 2024
1 parent bf05ea2 commit de86ea3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmdb-api/api/lib/perm/acl/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def add_login_log(cls, username, is_ok, description, _id=None, logout_at=None, i
is_ok=is_ok,
description=description,
logout_at=logout_at,
ip=ip or request.headers.get('X-Real-IP') or request.remote_addr,
ip=(ip or request.headers.get('X-Forwarded-For') or
request.headers.get('X-Real-IP') or request.remote_addr or '').split(',')[0],
browser=browser or request.headers.get('User-Agent'),
channel=request.values.get('channel', 'web'),
)
Expand Down

0 comments on commit de86ea3

Please sign in to comment.