diff --git a/amanuensis/server/auth.py b/amanuensis/server/auth.py index aed0509..6c2d2c8 100644 --- a/amanuensis/server/auth.py +++ b/amanuensis/server/auth.py @@ -33,7 +33,7 @@ def get_bp(login_manager): remember_me = form.remember.data login_user(u, remember=remember_me) config.logger.info("Logged in user '{}' ({})".format( - u.get('username'), u.uid)) + u.username, u.uid)) return redirect(url_for('home.home')) flash("Login not recognized") else: diff --git a/amanuensis/server/home.py b/amanuensis/server/home.py index d98c720..7d077b7 100644 --- a/amanuensis/server/home.py +++ b/amanuensis/server/home.py @@ -22,7 +22,7 @@ def get_bp(): @bp.route('/admin/', methods=['GET']) @login_required def admin(): - if not current_user.get('admin'): + if not current_user.admin: return redirect(url_for('home.home')) with config.json_ro('config.json') as j: diff --git a/amanuensis/templates/home/admin.html b/amanuensis/templates/home/admin.html index 98172a8..b265f2f 100644 --- a/amanuensis/templates/home/admin.html +++ b/amanuensis/templates/home/admin.html @@ -2,7 +2,7 @@ {% block title %}Admin | Amanuensis{% endblock %} {% block header %}

Amanuensis - Admin Dashboard

{% endblock %} -{% block sb_topline %}{{ current_user.get('displayname') }}{% endblock %} +{% block sb_topline %}{{ current_user.displayname }}{% endblock %} {% block sb_logout %}Log out{% endblock %} {% block sb_home %}Home{% endblock %} {% set template_sidebar_rows = [self.sb_topline(), self.sb_logout(), self.sb_home()] %} diff --git a/amanuensis/templates/home/home.html b/amanuensis/templates/home/home.html index 03c26f3..b4cec9b 100644 --- a/amanuensis/templates/home/home.html +++ b/amanuensis/templates/home/home.html @@ -2,11 +2,11 @@ {% block title %}Home | Amanuensis{% endblock %} {% block header %}

Amanuensis - Dashboard

{% endblock %} -{% block sb_topline %}{{ current_user.get('displayname') }}{% endblock %} +{% block sb_topline %}{{ current_user.displayname }}{% endblock %} {% block sb_logout %}Log out{% endblock %} {% set template_sidebar_rows = [self.sb_topline(), self.sb_logout()] %} -{% if current_user.get('admin') %} +{% if current_user.admin %} {% block sb_admin %}Admin{% endblock %} {% set template_sidebar_rows = template_sidebar_rows + [self.sb_admin()] %} {% endif %} diff --git a/amanuensis/user.py b/amanuensis/user.py index 54f74d1..ddbb89d 100644 --- a/amanuensis/user.py +++ b/amanuensis/user.py @@ -25,9 +25,6 @@ class User(UserMixin): def get_id(self): return self.uid - def get(self, key): - return self.config.get(key) - def set_password(self, pw): h = generate_password_hash(pw) with config.json_rw(self.config_path) as j: