def get_reset_token(self) -> str:
"""Get a token which a user can use to reset his password.
.. note:: Don't forget to commit the database.
:returns: A token that can be used in :py:meth:`User.reset_password` to
reset the password of a user.
"""
ts = URLSafeTimedSerializer(psef.app.config['SECRET_KEY'])
self.reset_token = str(uuid.uuid4())
return str(ts.dumps(self.username, salt=self.reset_token))
评论列表
文章目录