crafty-4/app/classes/web/base_handler.py
2020-08-11 20:36:09 -04:00

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)