diff options
Diffstat (limited to 'pyaggr3g470r/views/api/common.py')
-rw-r--r-- | pyaggr3g470r/views/api/common.py | 11 |
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) |