From 7ade2ecd359cd6c2c72997f21f0175da08e9bf7e Mon Sep 17 00:00:00 2001 From: Cory Sitko Date: Tue, 10 Oct 2017 10:18:28 -0400 Subject: [PATCH 1/5] make is_active, is_authenticated, and is_anonymous properties on the Anonymous class so that the login_required decorator will work correctly and disable anonymous browsing --- cps/templates/detail.html | 4 ++-- cps/templates/index.xml | 2 +- cps/templates/layout.html | 18 +++++++++--------- cps/templates/read.html | 2 +- cps/ub.py | 3 +++ cps/web.py | 20 ++++++++++---------- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/cps/templates/detail.html b/cps/templates/detail.html index c230b069..4a9fa8fb 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -42,7 +42,7 @@ {% if g.user.kindle_mail and g.user.is_authenticated %} {{_('Send to Kindle')}} {% endif %} - {% if (g.user.role_download() and g.user.is_anonymous()) or g.user.is_authenticated %} + {% if (g.user.role_download() and g.user.is_anonymous) or g.user.is_authenticated %}
{% endif %} - {% if not g.user.is_anonymous() %} + {% if not g.user.is_anonymous %}

diff --git a/cps/templates/index.xml b/cps/templates/index.xml index f0a6e2e0..99358941 100644 --- a/cps/templates/index.xml +++ b/cps/templates/index.xml @@ -34,7 +34,7 @@ {{url_for('feed_discover')}} {{_('Show Random Books')}} -{% if not current_user.is_anonymous() %} +{% if not current_user.is_anonymous %} {{_('Read Books')}} diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 6eded615..f2a16a02 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -34,7 +34,7 @@ {{instance}}

- {% if g.user.is_authenticated() or g.user.is_anonymous() %} + {% if g.user.is_authenticated or g.user.is_anonymous %}