mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 15:19:06 +00:00
[api] use device specific token
This commit is contained in:
@@ -449,3 +449,12 @@ def api_group_check(func):
|
||||
return api_error(status.HTTP_403_FORBIDDEN, 'Forbid to access this group.')
|
||||
|
||||
return _decorated
|
||||
|
||||
def get_client_ip(request):
|
||||
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR', '')
|
||||
if x_forwarded_for:
|
||||
ip = x_forwarded_for.split(',')[0]
|
||||
else:
|
||||
ip = request.META.get('REMOTE_ADDR', '')
|
||||
|
||||
return ip
|
||||
|
Reference in New Issue
Block a user