def encrypt_password():
"""
Verify if the route is for password reset or user create, then encrypts the password.
"""
if request.json is None or not 'password' in request.json:
return
if str(request.url_rule) == '/auth/user/' and request.method == 'POST' \
or str(request.url_rule) == '/auth/user/resetpassword/' and request.method == 'PUT':
request.json['password'] = generate_password_hash(request.json['password'])
评论列表
文章目录