Merge branch 'feature/server-side-render' into feature/server-side-render-devices
This commit is contained in:
commit
a23d3427fb
|
@ -36,6 +36,7 @@ class DevicehubConfig(Config):
|
||||||
import_resource(metric_def),
|
import_resource(metric_def),
|
||||||
),)
|
),)
|
||||||
PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str]
|
PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str]
|
||||||
|
SECRET_KEY = config('SECRET_KEY')
|
||||||
DB_USER = config('DB_USER', 'dhub')
|
DB_USER = config('DB_USER', 'dhub')
|
||||||
DB_PASSWORD = config('DB_PASSWORD', 'ereuse')
|
DB_PASSWORD = config('DB_PASSWORD', 'ereuse')
|
||||||
DB_HOST = config('DB_HOST', 'localhost')
|
DB_HOST = config('DB_HOST', 'localhost')
|
||||||
|
|
|
@ -23,6 +23,11 @@ from ereuse_devicehub.resources.inventory import Inventory, InventoryDef
|
||||||
from ereuse_devicehub.templating import Environment
|
from ereuse_devicehub.templating import Environment
|
||||||
|
|
||||||
|
|
||||||
|
from flask_login import LoginManager
|
||||||
|
from flask_wtf.csrf import CSRFProtect
|
||||||
|
from ereuse_devicehub.resources.user.models import User
|
||||||
|
|
||||||
|
|
||||||
class Devicehub(Teal):
|
class Devicehub(Teal):
|
||||||
test_client_class = Client
|
test_client_class = Client
|
||||||
Dummy = Dummy
|
Dummy = Dummy
|
||||||
|
@ -63,6 +68,20 @@ class Devicehub(Teal):
|
||||||
inv.command('search')(self.regenerate_search)
|
inv.command('search')(self.regenerate_search)
|
||||||
self.before_request(self._prepare_request)
|
self.before_request(self._prepare_request)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
@login_manager.user_loader
|
||||||
|
def load_user(user_id):
|
||||||
|
return User.query.get(user_id)
|
||||||
|
|
||||||
# noinspection PyMethodOverriding
|
# noinspection PyMethodOverriding
|
||||||
@click.option('--name', '-n',
|
@click.option('--name', '-n',
|
||||||
default='Test 1',
|
default='Test 1',
|
||||||
|
|
Reference in New Issue