security.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:opennms_alarmforwarder 作者: NETHINKS 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号