diff --git a/src/app.py b/src/app.py index 069e7c2..f01524b 100644 --- a/src/app.py +++ b/src/app.py @@ -54,7 +54,7 @@ for view in [ItemView, ProfileView, UploadView, IndexView, ContentView, Purchase health.add_check(health_database_status) app.add_url_rule("/healthz", "healthcheck", view_func=lambda: health.run()) -admin = Admin(app, index_view=AuthenticatedAdminIndexView()) +admin = Admin(app, index_view=AuthenticatedAdminIndexView(), name="Unstable Vortex Admin") admin.add_view(AuthenticatedModelView(User, db.session)) admin.add_view(AuthenticatedModelView(Comment, db.session)) admin.add_view(AuthenticatedModelView(Item, db.session)) @@ -80,5 +80,6 @@ def init_db(): roles=['administrator']) user.name = default_admin_username db.session.add(user) + app.logger.info("Users table is empty. Default admin user created!") db.session.commit() diff --git a/src/templates/admin/index.html b/src/templates/admin/index.html new file mode 100644 index 0000000..081fad4 --- /dev/null +++ b/src/templates/admin/index.html @@ -0,0 +1,6 @@ +{% extends 'admin/master.html' %} + +{% block body %} +

Hello {{ current_user.name }}!

+ Back to the site +{% endblock %} \ No newline at end of file diff --git a/src/utils/config.py b/src/utils/config.py index 67bcd58..fdd7f86 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -39,7 +39,7 @@ class Config: MINIO_SECURE = os.environ.get("MINIO_SECURE", "true").upper() == 'TRUE' # Admin stuff - DEFAULT_ADMIN_USER = os.environ.get("DEFAULT_ADMIN_USER") + DEFAULT_ADMIN_USER = os.environ.get("DEFAULT_ADMIN_USER", "admin") DEFAULT_ADMIN_PASSWORD = os.environ.get("DEFAULT_ADMIN_PASSWORD") DEFAULT_ADMIN_EMAIL = os.environ.get("DEFAULT_ADMIN_EMAIL")