mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
17 lines
446 B
Python
17 lines
446 B
Python
import logging
|
|
import tornado.web
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class BaseHandler(tornado.web.RequestHandler):
|
|
|
|
def get_remote_ip(self):
|
|
remote_ip = self.request.headers.get("X-Real-IP") or \
|
|
self.request.headers.get("X-Forwarded-For") or \
|
|
self.request.remote_ip
|
|
return remote_ip
|
|
|
|
def get_current_user(self):
|
|
return self.get_secure_cookie("user", max_age_days=1)
|