def reset_password(self, user_id):
"""
This method reset password of user with specified email
and send notification email on it
"""
user = db.session.query(User).filter_by(id=user_id).first()
password = self.generate_password()
hashed_password = self.password_to_hash(password)
# print password, " --> ", hashed_password
user.password = hashed_password
# print "Trying to reset password of ", user.full_name
db.session.commit()
try:
send_reset_password_email(user, password)
return {'result': 'success'}, 200
except Exception, error:
print "EXCEPTION: ", error
traceback.print_exc()
return {'result': 'error'}, 404
admin_controller.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录