def handle_2fa_required(self, request): from sentry.models import ApiKey from sentry.tasks.auth import remove_2fa_non_compliant_members actor_id = request.user.id if request.user and request.user.is_authenticated else None api_key_id = (request.auth.id if hasattr(request, "auth") and isinstance(request.auth, ApiKey) else None) ip_address = request.META["REMOTE_ADDR"] remove_2fa_non_compliant_members.delay(self.id, actor_id=actor_id, actor_key_id=api_key_id, ip_address=ip_address)
def handle_2fa_required(self, request): from sentry.models import ApiKey from sentry.tasks.auth import remove_2fa_non_compliant_members actor_id = request.user.id if request.user and request.user.is_authenticated() else None api_key_id = request.auth.id if hasattr( request, 'auth') and isinstance( request.auth, ApiKey) else None ip_address = request.META['REMOTE_ADDR'] remove_2fa_non_compliant_members.delay( self.id, actor_id=actor_id, actor_key_id=api_key_id, ip_address=ip_address )