def change_password(self, username, password):
"""change password of the given user
Args:
- username: name of the user
- password: new password of the user
Returns:
True, if password change was successful
False, if not
"""
try:
orm_session = model.Session()
user = orm_session.query(model.LocalUser).\
filter(model.LocalUser.user_name==username).\
first()
user.password_hash = self.__hash_password(password)
orm_session.commit()
orm_session.close()
except:
return False
return True
评论列表
文章目录