def find_by_oauth(cls, provider, openid): """Find user that has oauth info with given provider and openid""" oauth = UserOauth.objects(provider=provider, openid=openid).first() if oauth and oauth.user: return oauth.user