Python app.models 模块,AnonymousUser() 实例源码

我们从Python开源项目中,提取了以下18个代码示例,用于说明如何使用app.models.AnonymousUser()

项目:myproject    作者:dengliangshi    | 项目源码 | 文件源码
def verify_password(email_or_token, password):
    """Verify user using email and address or token, 
    otherwise, set as anonymous user.
    """
    if email_or_token == '':
        g.current_user = AnonymousUser()
        return True
    if password == '':
        g.current_user = User.verify_auth_token(email_or_token)
        g.token_used = True
        return g.current_user is not None
    user = User.query.filter_by(email=email_or_token).first()
    if not user:
        return False
    g.current_user = user
    g.token_used = False
    return user.verify_password(password)
项目:circleci-demo-python-flask    作者:CircleCI-Public    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:Simpleblog    作者:Blackyukun    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.operation(Permission.FOLLOW))
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:smart-iiot    作者:quanpower    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
        self.assertFalse(u.can(Permission.COMMENT))
        self.assertFalse(u.can(Permission.WRITE))
        self.assertFalse(u.can(Permission.MODERATE))
        self.assertFalse(u.can(Permission.ADMIN))
项目:maps4all-signup    作者:hack4impact    | 项目源码 | 文件源码
def test_anonymous(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.GENERAL))
项目:database_project    作者:HughWen    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:copyflask_web    作者:superchilli    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:project    作者:Junctionzc    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:Oyster-app    作者:XzAmrzs    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:Konsole    作者:ColinHaley    | 项目源码 | 文件源码
def test_anonymous(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.GENERAL))
项目:LivroFlask    作者:antoniocsz    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:flask-blog    作者:zhuwei05    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:blog    作者:hukaixuan    | 项目源码 | 文件源码
def test_anonymous_user(self):
        u = AnonymousUser()
        self.assertFalse(u.can(Permission.FOLLOW))
项目:ztool-backhend-mongo    作者:Z-Tool    | 项目源码 | 文件源码
def verify_password(email_or_token, password):
    if email_or_token == '':
        g.current_user = AnonymousUser()
        return True
    if password == '':
        g.current_user = User.verify_auth_token(email_or_token)
        g.token_used = True
        return g.current_user is not None
    user = User.objects.filter(email=email_or_token)
    if not user:
        return False
    user = user.first_or_404()
    g.current_user = user
    g.token_used = False
    return user.verify_password(password)
项目:ztool-backhend-mongo    作者:Z-Tool    | 项目源码 | 文件源码
def login_test():
    if g.current_user == AnonymousUser():
        return jsonify(status='error', data='Anonymous user!'), 401
    else:
        return jsonify(email=g.current_user.email, status='success')