Check remote_route for the real IP
All checks were successful
docker-image / docker (push) Successful in 1m21s
All checks were successful
docker-image / docker (push) Successful in 1m21s
This commit is contained in:
parent
7b6ad28168
commit
209bc07d82
2 changed files with 6 additions and 1 deletions
|
@ -15,6 +15,11 @@ class BottleHelpers:
|
|||
self.auth = auth
|
||||
self.group = group
|
||||
|
||||
def remote_addr(self):
|
||||
if request.remote_route is not None:
|
||||
return request.remote_route[-1]
|
||||
return request.remote_addr
|
||||
|
||||
def require_login(self, func: Callable) -> Callable:
|
||||
if self.group is not None:
|
||||
return self.auth.require_login(self.require_attribute('groups', self.group)(func))
|
||||
|
|
|
@ -98,7 +98,7 @@ def not_authorized(error):
|
|||
groups = request.session[auth.sess_attr]['groups']
|
||||
return {
|
||||
'user': auth.my_username,
|
||||
'ip': request.remote_addr,
|
||||
'ip': request.remote_route,
|
||||
'error': error,
|
||||
'code': code,
|
||||
'msg': msg,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue