mirror of
https://github.com/wassname/flask-security.git
synced 2026-06-27 16:10:11 +08:00
prevent password reset from breaking if you have no password
If you've just been invited, or are using social auth, you have no password set, so the reset password feature causes a crash. This doesn't need to happen.
This commit is contained in:
@@ -53,7 +53,8 @@ def generate_reset_password_token(user):
|
||||
|
||||
:param user: The user to work with
|
||||
"""
|
||||
data = [str(user.id), md5(user.password)]
|
||||
password_hash = md5(user.password) if user.password else None
|
||||
data = [str(user.id), password_hash]
|
||||
return _security.reset_serializer.dumps(data)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user