Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def authenticate_by_key(username, key):
logger.debug("user %s want to log in with key", username)
user_mc = mediacloud.MediaCloud(key)
if user_mc.verifyAuthToken():
user = create_and_cache_user(username, key)
user.set_profile(_get_user_profile(key))
logger.debug(" succeeded - got a key (user.is_anonymous=%s)", user.is_anonymous)
return user
logger.debug("failed")
return flask_login.AnonymousUserMixin()
def authenticate_by_key(username, key):
user_mc = mcapi.MediaCloud(key)
if user_mc.verifyAuthToken():
profile = user_mc.userProfile()
user = User(username, key, profile=profile)
User.cached[user.id] = user
return user
return AnonymousUserMixin()