Fixed little things

This commit is contained in:
Pünkösd Marcell 2020-11-29 02:13:30 +01:00
parent 116ef34a9a
commit 69555d4444
3 changed files with 9 additions and 2 deletions

View File

@ -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()

View File

@ -0,0 +1,6 @@
{% extends 'admin/master.html' %}
{% block body %}
<h2>Hello {{ current_user.name }}!</h2>
<a href="/" class="btn btn-secondary">Back to the site</a>
{% endblock %}

View File

@ -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")