# HG changeset patch # User Marcin Kuzminski # Date 2017-10-07 08:02:57 # Node ID 6de97439953fcd5f31d40fcf43ab5c5626eec08a # Parent 8e19a416641ec202494b72f1d6abd5f09193edc1 auth-rhodecode: don't fail on bcrypt if user password is set to None. Default to emptry string to not cause an exception. diff --git a/rhodecode/authentication/plugins/auth_rhodecode.py b/rhodecode/authentication/plugins/auth_rhodecode.py --- a/rhodecode/authentication/plugins/auth_rhodecode.py +++ b/rhodecode/authentication/plugins/auth_rhodecode.py @@ -114,7 +114,7 @@ class RhodeCodeAuthPlugin(RhodeCodeAuthP crypto_backend = auth.crypto_backend() password_encoded = safe_str(password) password_match, new_hash = crypto_backend.hash_check_with_upgrade( - password_encoded, userobj.password) + password_encoded, userobj.password or '') if password_match and new_hash: log.debug('user %s properly authenticated, but ' diff --git a/rhodecode/model/user.py b/rhodecode/model/user.py --- a/rhodecode/model/user.py +++ b/rhodecode/model/user.py @@ -256,8 +256,9 @@ class UserModel(BaseModel): log_create_user, check_allowed_create_user) def _password_change(new_user, password): + old_password = new_user.password or '' # empty password - if not new_user.password: + if not old_password: return False # password check is only needed for RhodeCode internal auth calls @@ -269,7 +270,7 @@ class UserModel(BaseModel): if new_user.password == password: return False - password_match = check_password(password, new_user.password) + password_match = check_password(password, old_password) if not password_match: return True