def generate_reset_token(self, expiry=900):
"""Generate a JSON Web Signature that will be used to reset customer's
password. For details see
:meth:`itsdangerous.JSONWebSignatureSerializer.dumps`
:param expiry: Token expiration time (seconds)
:return:
"""
s = TimedJSONWebSignatureSerializer(
current_app.config['SECRET_KEY'], expiry
)
return s.dumps({'user_id': self.id})
评论列表
文章目录