Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: fix passing slug=None to HC slug check #73121

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/sentry/web/frontend/auth_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,11 @@ def org_exists(self, request: Request) -> bool:
"""
Returns True if the organization passed in a request exists.
"""
return bool(
return request.subdomain is not None and (
organization_service.check_organization_by_slug(
slug=request.subdomain, only_visible=True
)
is not None
)

def can_register(self, request: Request) -> bool:
Expand Down Expand Up @@ -563,13 +564,7 @@ def handle_basic_auth(self, request: Request, **kwargs) -> HttpResponseBase:
op = request.POST.get("op")
organization = kwargs.pop("organization", None)

org_exists = bool(
organization_service.check_organization_by_slug(
slug=request.subdomain, only_visible=True
)
)

if request.method == "GET" and request.subdomain and org_exists:
if request.method == "GET" and request.subdomain and self.org_exists(request):
urls = [
reverse("sentry-auth-organization", args=[request.subdomain]),
reverse("sentry-register"),
Expand Down
Loading