From e8b0c628180dde83039045d57fa32d3b84e6252d Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Thu, 4 Apr 2013 10:23:51 -0400 Subject: [PATCH] Update CHANGES and a little polish --- CHANGES | 8 ++++++++ flask_security/decorators.py | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 0c952be..af4987e 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,14 @@ Flask-Security Changelog Here you can see the full list of changes between each Flask-Security release. +Version 1.6.2 +------------- + +Released April 4th 2013 + +- Fixed bug with http basic auth + + Version 1.6.1 ------------- diff --git a/flask_security/decorators.py b/flask_security/decorators.py index 12c80c5..79b4bae 100644 --- a/flask_security/decorators.py +++ b/flask_security/decorators.py @@ -9,6 +9,7 @@ :license: MIT, see LICENSE for more details. """ +from collections import namedtuple from functools import wraps from flask import current_app, Response, request, redirect, _request_ctx_stack @@ -30,6 +31,8 @@ _default_unauthorized_html = """ or your browser doesn't understand how to supply the credentials required.

""" +BasicAuth = namedtuple('BasicAuth', 'username, password') + def _get_unauthorized_response(text=None, headers=None): text = text or _default_unauthorized_html @@ -67,9 +70,7 @@ def _check_token(): def _check_http_auth(): - from collections import namedtuple - Auth = namedtuple('Auth', 'username, password') - auth = request.authorization or Auth(username=None, password=None) + auth = request.authorization or BasicAuth(username=None, password=None) user = _security.datastore.find_user(email=auth.username) if user and utils.verify_and_update_password(auth.password, user):