Merge branch 'feature/server-side-render' into feature/server-side-render-devices

This commit is contained in:
Santiago L 2022-01-26 12:50:54 +01:00
commit 15161e505f
2 changed files with 16 additions and 6 deletions

View file

@ -67,9 +67,6 @@ class Devicehub(Teal):
self.configure_extensions()
def configure_extensions(self):
# configure & enable CSRF of Flask-WTF
CSRFProtect(self)
# configure Flask-Login
login_manager = LoginManager()
login_manager.init_app(self)

View file

@ -1,9 +1,22 @@
from ereuse_devicehub.devicehub import Devicehub
"""
Example app with minimal configuration.
Use this as a starting point.
"""
from flask_wtf.csrf import CSRFProtect
app = Devicehub(inventory='db1')
from ereuse_devicehub.config import DevicehubConfig
from ereuse_devicehub.devicehub import Devicehub
from ereuse_devicehub.inventory.views import devices
from ereuse_devicehub.views import core
app = Devicehub(inventory=DevicehubConfig.DB_SCHEMA)
app.register_blueprint(core)
app.register_blueprint(devices)
# configure & enable CSRF of Flask-WTF
# NOTE: enable by blueprint to exclude API views
# TODO(@slamora: enable by default & exclude API views when decouple of Teal is completed
csrf = CSRFProtect(app)
csrf.protect(core)
csrf.protect(devices)