update to work with newer versions of Flask-Login

This commit is contained in:
Kyle Mahan 2016-01-30 14:08:54 -08:00
parent d915b98175
commit a37c49aa13
5 changed files with 11 additions and 8 deletions

View file

@ -19,12 +19,15 @@ class User(db.Model):
settings = db.Column(JSON) settings = db.Column(JSON)
# Flask-Login integration # Flask-Login integration
@property
def is_authenticated(self): def is_authenticated(self):
return True return True
@property
def is_active(self): def is_active(self):
return True return True
@property
def is_anonymous(self): def is_anonymous(self):
return False return False

View file

@ -20,7 +20,7 @@
</head> </head>
<body> <body>
<header> <header>
{% if current_user.is_authenticated() %} {% if current_user.is_authenticated %}
<div style="overflow: auto;"> <div style="overflow: auto;">
<span class="h-x-app" style="font-weight: bold"> <span class="h-x-app" style="font-weight: bold">
<img class="u-logo" src="{{ url_for('static', filename='logo.png') }}" style="max-height: 1.5em; vertical-align: middle;" /> <img class="u-logo" src="{{ url_for('static', filename='logo.png') }}" style="max-height: 1.5em; vertical-align: middle;" />
@ -54,7 +54,7 @@
<div class="flash">{{ message }}</div> <div class="flash">{{ message }}</div>
{% endfor %} {% endfor %}
{% if not current_user.is_authenticated() %} {% if not current_user.is_authenticated %}
<form action="{{ url_for('.login') }}" method="POST"> <form action="{{ url_for('.login') }}" method="POST">
<input type="url" name="me" placeholder="https://yourdomain.com" /> <input type="url" name="me" placeholder="https://yourdomain.com" />
<input type="hidden" name="next" placeholder="{{ request.path }}" /> <input type="hidden" name="next" placeholder="{{ request.path }}" />

View file

@ -15,7 +15,7 @@
{% endblock head %} {% endblock head %}
{% block header %} {% block header %}
{% if current_user.is_authenticated() %} {% if current_user.is_authenticated %}
<form action="{{ url_for('.subscribe') }}" method="POST"> <form action="{{ url_for('.subscribe') }}" method="POST">
<input type="url" id="origin" name="origin" placeholder="Subscribe to URL" /> <input type="url" id="origin" name="origin" placeholder="Subscribe to URL" />
</form> </form>

View file

@ -5,7 +5,7 @@
{% endblock head %} {% endblock head %}
{% block header %} {% block header %}
{% if current_user.is_authenticated() %} {% if current_user.is_authenticated %}
<form action="{{ url_for('.subscribe') }}" method="POST"> <form action="{{ url_for('.subscribe') }}" method="POST">
<input type="url" id="origin" name="origin" placeholder="Subscribe to URL" /> <input type="url" id="origin" name="origin" placeholder="Subscribe to URL" />
</form> </form>

View file

@ -34,7 +34,7 @@ def index():
solo = False solo = False
all_tags = set() all_tags = set()
if flask_login.current_user.is_authenticated(): if flask_login.current_user.is_authenticated:
for subsc in flask_login.current_user.subscriptions: for subsc in flask_login.current_user.subscriptions:
if subsc.tags: if subsc.tags:
all_tags.update(subsc.tags.split()) all_tags.update(subsc.tags.split())
@ -322,7 +322,7 @@ def update_micropub_syndicate_to():
resp, resp.text) resp, resp.text)
return return
flask.current_app.logger.debug('response from micropub endpoint: {}, {}', flask.current_app.logger.debug('syndicate-to response: {}, {}',
resp, resp.text) resp, resp.text)
content_type = resp.headers['content-type'] content_type = resp.headers['content-type']