aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views/api
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-05 19:25:19 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-05 19:25:19 +0100
commit167e282e0dded657c40c6192395bd0e3203908be (patch)
tree7327c1f137df7fe426c87c02106bde50639c36b3 /pyaggr3g470r/views/api
parentProvides to the user a way to set the error count of a feed to 0 by enabling ... (diff)
downloadnewspipe-167e282e0dded657c40c6192395bd0e3203908be.tar.gz
newspipe-167e282e0dded657c40c6192395bd0e3203908be.tar.bz2
newspipe-167e282e0dded657c40c6192395bd0e3203908be.zip
Fix the authenticate decorator.
Diffstat (limited to 'pyaggr3g470r/views/api')
-rw-r--r--pyaggr3g470r/views/api/common.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pyaggr3g470r/views/api/common.py b/pyaggr3g470r/views/api/common.py
index 4f703712..48a0d0ac 100644
--- a/pyaggr3g470r/views/api/common.py
+++ b/pyaggr3g470r/views/api/common.py
@@ -48,11 +48,12 @@ def authenticate(func):
else:
# authentication via HTTP only
auth = request.authorization
- user = User.query.filter(User.nickname == auth.username).first()
- if user and user.check_password(auth.password) \
- and user.activation_key == "":
- g.user = user
- logged_in = True
+ if auth is not None:
+ user = User.query.filter(User.nickname == auth.username).first()
+ if user and user.check_password(auth.password) \
+ and user.activation_key == "":
+ g.user = user
+ logged_in = True
if logged_in:
return func(*args, **kwargs)
bgstack15