def verify_token(token): # TODO: Make this less scary. if CONFIG["DEBUG"] and CONFIG["BYPASS_API_AUTH"]: return True user = User.verify_auth_token(token) if user is None: return False return True
def verify_password(username_or_token, password): print username_or_token user = User.verify_auth_token(username_or_token) if not user: user = User.query.filter_by(email=username_or_token).first() if not user or not user.verifypwd(password): return False g.user = user return True