Development
This commit is contained in:
parent
44261e5b5c
commit
8a8e947fcf
9 changed files with 289 additions and 33 deletions
|
|
@ -32,8 +32,13 @@ from api_apply_health import bp as api_apply_health_bp
|
|||
from session_interface import SqliteSessionInterface
|
||||
|
||||
app = Flask(__name__)
|
||||
app.session_interface = SqliteSessionInterface(config_utils.ACCOUNTS_DB)
|
||||
config_utils.init_accounts_db()
|
||||
if settings.is_single_user():
|
||||
from session_interface import SingleUserSessionInterface
|
||||
config_utils.init_single_user_session_db()
|
||||
app.session_interface = SingleUserSessionInterface(config_utils.ACCOUNTS_DB)
|
||||
else:
|
||||
app.session_interface = SqliteSessionInterface(config_utils.ACCOUNTS_DB)
|
||||
config_utils.init_accounts_db()
|
||||
|
||||
# Static www/ serving =================================================
|
||||
|
||||
|
|
@ -83,6 +88,9 @@ def serve_view(page_name):
|
|||
if not factory.passes(view_req, level):
|
||||
return redirect('/overview' if level > 0 else '/accountlogin')
|
||||
|
||||
if settings.is_single_user() and page_name in ('accountmanage', 'accountcreate', 'accountverifyemail'):
|
||||
return redirect('/overview' if level > 0 else '/accountlogin')
|
||||
|
||||
cfg = config_utils.load_config()
|
||||
|
||||
if level >= factory.LEVEL_RANK['administrator']:
|
||||
|
|
@ -138,10 +146,11 @@ app.register_blueprint(physicalinterfaces_bp)
|
|||
app.register_blueprint(portforwarding_bp)
|
||||
app.register_blueprint(portwrangling_bp)
|
||||
app.register_blueprint(preferences_bp)
|
||||
app.register_blueprint(accountverifyemail_bp)
|
||||
if not settings.is_single_user():
|
||||
app.register_blueprint(accountverifyemail_bp)
|
||||
app.register_blueprint(accountcreate_bp)
|
||||
app.register_blueprint(accountmanage_bp)
|
||||
app.register_blueprint(vpn_bp)
|
||||
app.register_blueprint(accountcreate_bp)
|
||||
app.register_blueprint(accountmanage_bp)
|
||||
app.register_blueprint(accountlogout_bp)
|
||||
app.register_blueprint(mdns_bp)
|
||||
app.register_blueprint(radius_bp)
|
||||
|
|
@ -151,6 +160,8 @@ app.register_blueprint(api_apply_health_bp)
|
|||
|
||||
|
||||
def _seed_initial_account():
|
||||
if settings.is_single_user():
|
||||
return
|
||||
import uuid as _uuid, time as _t
|
||||
email = settings.get_initial_manager_email()
|
||||
if not email:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue