Finished admin console

This commit is contained in:
2022-06-15 23:54:44 +01:00
parent 62160beab2
commit 2ea778143e
33 changed files with 198 additions and 206 deletions

View File

@@ -2,7 +2,7 @@ from .data import load
from ..models import User
from flask import abort, redirect
from flask.helpers import url_for
from flask.helpers import flash, url_for
from flask_login import current_user
from functools import wraps
@@ -10,7 +10,9 @@ from functools import wraps
def require_account_creation(function):
@wraps(function)
def wrapper(*args, **kwargs):
if User.query.count() == 0: return redirect(url_for('views._register'))
if User.query.count() == 0:
flash('Please register a user account.', 'alert')
return redirect(url_for('admin._register'))
return function(*args, **kwargs)
return wrapper