Compare commits

...
3 Commits
6 changed files with 27 additions and 16 deletions
+8
View File
@@ -3,6 +3,14 @@ Flask-Security Changelog
Here you can see the full list of changes between each Flask-Security release. Here you can see the full list of changes between each Flask-Security release.
Version 1.7.1
-------------
Released January 14th 2014
- Fixed a bug where passwords would fail to verify when specifying a password hash algorithm
Version 1.7.0 Version 1.7.0
------------- -------------
+1 -1
View File
@@ -49,7 +49,7 @@ copyright = u'2012, Matt Wright'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '1.7.0' version = '1.7.1'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = version release = version
+1 -1
View File
@@ -10,7 +10,7 @@
:license: MIT, see LICENSE for more details. :license: MIT, see LICENSE for more details.
""" """
__version__ = '1.7.0' __version__ = '1.7.1'
from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user
from .datastore import SQLAlchemyUserDatastore, MongoEngineUserDatastore, PeeweeUserDatastore from .datastore import SQLAlchemyUserDatastore, MongoEngineUserDatastore, PeeweeUserDatastore
+6 -3
View File
@@ -121,7 +121,10 @@ def verify_and_update_password(password, user):
:param password: A plaintext password to verify :param password: A plaintext password to verify
:param user: The user to verify against :param user: The user to verify against
""" """
verified, new_password = _pwd_context.verify_and_update(encrypt_password(password), user.password)
if _security.password_hash != 'plaintext':
password = get_hmac(password)
verified, new_password = _pwd_context.verify_and_update(password, user.password)
if verified and new_password: if verified and new_password:
user.password = new_password user.password = new_password
_datastore.put(user) _datastore.put(user)
@@ -135,8 +138,8 @@ def encrypt_password(password):
""" """
if _security.password_hash == 'plaintext': if _security.password_hash == 'plaintext':
return password return password
signed = get_hmac(password) signed = get_hmac(password).decode('ascii')
return _pwd_context.encrypt(signed.decode('ascii')) return _pwd_context.encrypt(signed)
def md5(data): def md5(data):
+1 -1
View File
@@ -20,7 +20,7 @@ from setuptools import setup
setup( setup(
name='Flask-Security', name='Flask-Security',
version='1.7.0', version='1.7.1',
url='https://github.com/mattupstate/flask-security', url='https://github.com/mattupstate/flask-security',
license='MIT', license='MIT',
author='Matt Wright', author='Matt Wright',
+10 -10
View File
@@ -19,18 +19,18 @@ from flask_security.signals import user_registered
from tests import SecurityTest from tests import SecurityTest
# TODO: Wait for passlib + bcrypt python3 compatibility to be fixed
# class ConfiguredPasswordHashSecurityTests(SecurityTest):
# AUTH_CONFIG = { class ConfiguredPasswordHashSecurityTests(SecurityTest):
# 'SECURITY_PASSWORD_HASH': 'bcrypt',
# 'SECURITY_PASSWORD_SALT': 'so-salty',
# 'USER_COUNT': 1
# }
# def test_authenticate(self): AUTH_CONFIG = {
# r = self.authenticate(endpoint="/login") 'SECURITY_PASSWORD_HASH': 'bcrypt',
# self.assertIn(b'Home Page', r.data) 'SECURITY_PASSWORD_SALT': 'so-salty',
'USER_COUNT': 1
}
def test_authenticate(self):
r = self.authenticate(endpoint="/login")
self.assertIn(b'Home Page', r.data)
class ConfiguredSecurityTests(SecurityTest): class ConfiguredSecurityTests(SecurityTest):