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
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
{% if g.user.kindle_mail and g.user.is_authenticated %}
|
||||
<a href="{{url_for('send_to_kindle', book_id=entry.id)}}" id="sendbtn" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-send"></span> {{_('Send to Kindle')}}</a>
|
||||
{% 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 %}
|
||||
<div class="btn-group" role="group">
|
||||
<button id="read-in-browser" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="glyphicon glyphicon-eye-open"></span> {{_('Read in browser')}}
|
||||
@@ -157,7 +157,7 @@
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not g.user.is_anonymous() %}
|
||||
{% if not g.user.is_anonymous %}
|
||||
|
||||
<div class="custom_columns">
|
||||
<p>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<id>{{url_for('feed_discover')}}</id>
|
||||
<content type="text">{{_('Show Random Books')}}</content>
|
||||
</entry>
|
||||
{% if not current_user.is_anonymous() %}
|
||||
{% if not current_user.is_anonymous %}
|
||||
<entry>
|
||||
<title>{{_('Read Books')}}</title>
|
||||
<link rel="subsection" href="{{url_for('feed_read_books')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{url_for('index')}}">{{instance}}</a>
|
||||
</div>
|
||||
{% if g.user.is_authenticated() or g.user.is_anonymous() %}
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
<form class="navbar-form navbar-left" role="search" action="{{url_for('search')}}" method="GET">
|
||||
<div class="form-group input-group input-group-sm">
|
||||
<label for="query" class="sr-only">{{_('Search')}}</label>
|
||||
@@ -46,13 +46,13 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
<div class="navbar-collapse collapse">
|
||||
{% if g.user.is_authenticated() or g.user.is_anonymous() %}
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
<ul class="nav navbar-nav ">
|
||||
<li><a href="{{url_for('advanced_search')}}"><span class="glyphicon glyphicon-search"></span><span class="hidden-sm"> {{_('Advanced Search')}}</span></a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<ul class="nav navbar-nav navbar-right" id="main-nav">
|
||||
{% if g.user.is_authenticated() or g.user.is_anonymous() %}
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
{% if g.user.role_upload() or g.user.role_admin()%}
|
||||
{% if g.allow_upload %}
|
||||
<li>
|
||||
@@ -68,14 +68,14 @@
|
||||
<li><a id="top_admin" href="{{url_for('admin')}}"><span class="glyphicon glyphicon-dashboard"></span><span class="hidden-sm"> {{_('Admin')}}</span></a></li>
|
||||
{% endif %}
|
||||
<li><a id="top_user" href="{{url_for('profile')}}"><span class="glyphicon glyphicon-user"></span><span class="hidden-sm"> {{g.user.nickname}}</span></a></li>
|
||||
{% if not g.user.is_anonymous() %}
|
||||
{% if not g.user.is_anonymous %}
|
||||
<li><a id="logout" href="{{url_for('logout')}}"><span class="glyphicon glyphicon-log-out"></span><span class="hidden-sm"> {{_('Logout')}}</span></a></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if not g.user.is_authenticated() %}
|
||||
{% if not g.user.is_authenticated %}
|
||||
<li><a id="login" href="{{url_for('login')}}"><span class="glyphicon glyphicon-log-in"></span> {{_('Login')}}</a></li>
|
||||
{% endif %}
|
||||
{% if g.allow_registration and not g.user.is_authenticated() %}
|
||||
{% if g.allow_registration and not g.user.is_authenticated %}
|
||||
<li><a id="register" href="{{url_for('register')}}"><span class="glyphicon glyphicon-user"></span> {{_('Register')}}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
@@ -101,7 +101,7 @@
|
||||
{% endfor %}
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
{% if g.user.is_authenticated() or g.user.is_anonymous() %}
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
<div class="col-sm-2">
|
||||
<nav class="navigation">
|
||||
<ul class="list-unstyled" id="scnd-nav" intent in-standard-append="nav.navigation" in-mobile-after="#main-nav" in-mobile-class="nav navbar-nav">
|
||||
@@ -142,7 +142,7 @@
|
||||
{% if g.user.filter_language() == 'all' and g.user.show_language() %}
|
||||
<li id="nav_lang"><a href="{{url_for('language_overview')}}"><span class="glyphicon glyphicon-flag"></span> {{_('Languages')}} </a></li>
|
||||
{%endif%}
|
||||
{% if g.user.is_authenticated() or g.user.is_anonymous() %}
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
<li class="nav-head hidden-xs">{{_('Public Shelves')}}</li>
|
||||
{% for shelf in g.public_shelfes %}
|
||||
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list"></span> {{shelf.name}}</a></li>
|
||||
@@ -151,7 +151,7 @@
|
||||
{% for shelf in g.user.shelf %}
|
||||
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list"></span> {{shelf.name}}</a></li>
|
||||
{% endfor %}
|
||||
{% if not g.user.is_anonymous() %}
|
||||
{% if not g.user.is_anonymous %}
|
||||
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('create_shelf')}}">{{_('Create a Shelf')}}</a></li>
|
||||
<li id="nav_about"><a href="{{url_for('stats')}}"><span class="glyphicon glyphicon-info-sign"></span> {{_('About')}}</a></li>
|
||||
{% endif %}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
bookUrl: "{{ url_for('static', filename=bookid) }}/",
|
||||
bookmarkUrl: "{{ url_for('bookmark', book_id=bookid, book_format='EPUB') }}",
|
||||
bookmark: "{{ bookmark.bookmark_key if bookmark != None }}",
|
||||
useBookmarks: {{ g.user.is_authenticated() | tojson }}
|
||||
useBookmarks: {{ g.user.is_authenticated | tojson }}
|
||||
};
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
|
||||
|
||||
Reference in New Issue
Block a user