Development
This commit is contained in:
parent
563d82daf3
commit
70ccfe2c29
48 changed files with 549 additions and 578 deletions
|
|
@ -1,8 +1,8 @@
|
|||
from pathlib import Path
|
||||
from flask import Blueprint, request, session, redirect, flash
|
||||
import json, bcrypt
|
||||
from auth import require_level
|
||||
from config_utils import ACCOUNTS_FILE
|
||||
import auth
|
||||
import config_utils
|
||||
import sanitize
|
||||
|
||||
_PAGE = Path(__file__).parent.name
|
||||
|
|
@ -13,18 +13,18 @@ bp = Blueprint(_PAGE, __name__)
|
|||
|
||||
def _load_accounts():
|
||||
try:
|
||||
with open(ACCOUNTS_FILE) as f:
|
||||
with open(config_utils.ACCOUNTS_FILE) as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
return {'accounts': []}
|
||||
|
||||
def _save_accounts(data):
|
||||
with open(ACCOUNTS_FILE, 'w') as f:
|
||||
with open(config_utils.ACCOUNTS_FILE, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
|
||||
@bp.route('/action/preferences/accountdetails_save', methods=['POST'])
|
||||
@require_level('viewer')
|
||||
@auth.require_level('viewer')
|
||||
def accountdetails_save():
|
||||
tz = sanitize.timezone(request.form.get('timezone', '').strip())
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ def accountdetails_save():
|
|||
|
||||
|
||||
@bp.route('/action/preferences/changepassword_save', methods=['POST'])
|
||||
@require_level('viewer')
|
||||
@auth.require_level('viewer')
|
||||
def changepassword_save():
|
||||
current_password = request.form.get('current_password', '')
|
||||
new_password = request.form.get('new_password', '')
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import json
|
||||
from flask import session
|
||||
import sanitize
|
||||
from config_utils import collect_layout_tokens
|
||||
import config_utils
|
||||
|
||||
|
||||
def collect_tokens(cfg):
|
||||
tokens = collect_layout_tokens(cfg)
|
||||
tokens = config_utils.collect_layout_tokens(cfg)
|
||||
blank = [{'value': '', 'label': '-- Select timezone --'}]
|
||||
tokens['PREF_EMAIL'] = session.get('email_address', '')
|
||||
tokens['PREF_TIMEZONE'] = session.get('timezone', '')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue