aboutsummaryrefslogtreecommitdiffstats
path: root/pysite
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-04-01 23:22:45 +0100
committerGravatar Gareth Coles <[email protected]>2018-04-01 23:22:45 +0100
commit9e58f066ef123edf22371e721296d343198c6d8a (patch)
treea4e9d025ef4f54960c1f10a6eede52cee7671f1a /pysite
parentLinting (diff)
Fix tests
Diffstat (limited to 'pysite')
-rw-r--r--pysite/route_manager.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pysite/route_manager.py b/pysite/route_manager.py
index ec0a84e3..6354f242 100644
--- a/pysite/route_manager.py
+++ b/pysite/route_manager.py
@@ -34,7 +34,6 @@ class RouteManager:
self.app.secret_key = os.environ.get("WEBPAGE_SECRET_KEY", "super_secret")
self.app.config["SERVER_NAME"] = os.environ.get("SERVER_NAME", "pythondiscord.local:8080")
self.app.config["PREFERRED_URL_SCHEME"] = PREFERRED_URL_SCHEME
- self.app.config["WTF_CSRF_CHECK_DEFAULT "] = False # We only want to protect specific routes
self.app.before_request(self.db.before_request)
self.app.teardown_request(self.db.teardown_request)
@@ -73,6 +72,9 @@ class RouteManager:
except Exception:
logging.getLogger(__name__).exception(f"Failed to register blueprint for subdomain: {sub}")
+ # if sub == "api":
+ # CSRF.exempt(sub_blueprint)
+
# Load the websockets
self.ws_blueprint = Blueprint("ws", __name__)
@@ -81,7 +83,9 @@ class RouteManager:
self.sockets.register_blueprint(self.ws_blueprint, url_prefix="/ws")
self.app.before_request(self.https_fixing_hook) # Try to fix HTTPS issues
+
CSRF.init_app(self.app) # Set up CSRF protection
+ self.app.config["WTF_CSRF_CHECK_DEFAULT "] = False # We only want to protect specific routes
def https_fixing_hook(self):
"""