__init__.py 文件源码

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

项目:auth-tool 作者: luciddg 项目源码 文件源码
def login(self, username=None, password=None):
        if username is None or password is None:
            raise cherrypy.HTTPError(400, 'Bad Request')

        try:
            cherrypy.session['user'] = User(username)
            cherrypy.session['auth'] = cherrypy.session['user'].authenticate(password)
            return {'ok': cherrypy.session['user'].auth}
        except (InvalidUser, InvalidCredentials):
            return {
                'ok': False,
                'error': 'Invalid credentials.  Try again.'
            }
        except UserModelException:
            return {'ok': False}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号