我们从Python开源项目中,提取了以下33个代码示例,用于说明如何使用flask.g.token_used()。
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)
def verify_password(username, password): authorization = request.headers.get('Authorization', '').split(' ') bearer = authorization[1] if len(authorization) > 1 else '' if bearer: g.current_user = User.verify_access_token(bearer) g.token_used = True return g.current_user is not None if username == '': g.current_user = AnonymousUser() return True user = User(username=username) if not user or not user.user_id: return False g.current_user = user g.token_used = False return user.verify_password(password)
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.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) # 401
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.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)
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.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)
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid credentials') return jsonify({'token': g.current_user.generate_auth_token( expiration=3600), 'expiration': 3600})
def verify_password(email_or_token, password): if email_or_token == '': return False 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)
def verify_password(openid_or_token, password): print 'api: verify password' print openid_or_token if openid_or_token == '': print 'openid_or_token == null' g.current_user = AnonymousUser() return True user = User.verify_auth_token(openid_or_token) if user: # token?? print 'token login' g.token_used = True else: user = User.query.filter_by(openId=openid_or_token).first() if user: # openId?? print 'openid login' g.token_used = False else: # ?token?openId?? return False g.current_user = user print g.token_used, user return True # ?????????
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid credentials') return jsonify({'token': g.current_user.generate_auth_token(expiration=3600), 'expiratioin': 3600})
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.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)
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid credentials') return jsonify({'token': g.current_user.generate_auth_token( expiration = 3600), 'expiration': 3600})
def verify_password(email_or_token, password): if email == '': 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)
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid credentials') return jsonify(token=g.current_user.generate_auth_token(expiration=86400), expiration=86400, email=g.current_user.email)
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid creentials') return jsonify({'token': g.current_user.generate_auth_token( expiration=3600), 'expiration':3600})
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)
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid credentials') return jsonify(token=g.current_user.generate_auth_token(expiration=86400).decode(), expiration=86400, email=g.current_user.email)
def get_token(): if g.current_user.is_anonymous or g.token_used: return unauthorized('Invalid credentials') return jsonify({'token':g.current_user.generate_auth_token(expiration=3600),'expiration':3600})