Repository navigation
ref(auth): Remove legacy login, registration, and MFA handlers - #126712
Merged
evanpurkhiser merged 1 commit intoOct 9, 2026
Merged
evanpurkhiser merged 1 commit into
evanpurkhiser merged 1 commit into
Conversation
evanpurkhiser
changed the base branch from
master
to
git/ref-auth-always-enable-react-authentication
October 7, 2026 14:34
Base automatically changed from
git/ref-auth-always-enable-react-authentication
to
master
October 7, 2026 14:43
evanpurkhiser
force-pushed
the
git/ref-auth-remove-legacy-organization-login-get-handling
branch
2 times, most recently
from
October 7, 2026 19:09
f035c27 to
5741764
Compare
evanpurkhiser
force-pushed
the
git/ref-auth-remove-legacy-organization-login-get-handling
branch
from
October 7, 2026 19:13
5741764 to
8c4e0d3
Compare
evanpurkhiser
added a commit
that referenced
this pull request
Oct 7, 2026
Remove the LESS for password/social-login columns and the join-request tab from the retired Django login templates, including their mobile overrides. Land after #126712 has deployed. Kept separate from the backend removal because frontend and backend deploy independently. Audited selector consumers across Sentry source (including provider templates) and Getsentry. Shared auth containers/footers, provider logos, org avatars, social-signup radio fields, SSO grids, and the auth-toggle used by the SAML IdP selector remain live. Validation: the complete sentry.less entry point compiles successfully; applicable pre-commit checks passed. This deletes 65 lines from layout.less.
evanpurkhiser
force-pushed
the
git/ref-auth-remove-legacy-organization-login-get-handling
branch
from
October 7, 2026 19:26
8c4e0d3 to
4016d08
Compare
evanpurkhiser
added a commit
that referenced
this pull request
Oct 7, 2026
React registration and password reset use the password strength ring. Remove the template initialization hook, its configuration type and test, and the rectangular indicator and its styles. Keep shared zxcvbn scoring, the ring, and its lazy-loaded React wrapper. Remove the lint suppression for the deleted styled component. Land after #126712 has deployed: the retired organization-login template is the last production caller of the bootstrap hook. Frontend and backend deploy independently. Validation: 17 tests passed across the bootstrap queue, registration form, and password reset suites. Full-project typecheck and pre-commit checks passed.
evanpurkhiser
force-pushed
the
git/ref-auth-remove-legacy-organization-login-get-handling
branch
from
October 8, 2026 14:45
4016d08 to
b47b6bc
Compare
evanpurkhiser
force-pushed
the
git/ref-auth-remove-legacy-organization-login-get-handling
branch
from
October 8, 2026 14:50
b47b6bc to
f84fe69
Compare
Comment on lines
57
to
+62
| def get(self, request: HttpRequest, **kwargs) -> HttpResponseBase: | ||
| customer_domain_redirect = self.get_customer_domain_login_redirect(request) | ||
| if customer_domain_redirect is not None: | ||
| return customer_domain_redirect | ||
|
|
||
| if should_render_react_auth(request): | ||
| return self.handle_react(request) | ||
|
|
||
| next_uri = self.get_next_uri(request=request) | ||
| if request.user.is_authenticated: | ||
| return self.redirect_authenticated_user(request=request, next_uri=next_uri) | ||
|
|
||
| request.session.set_test_cookie() | ||
|
|
||
| # Initiate login clears the pending session states so you don't end up at an odd location | ||
| initiate_login(request=request, next_url=next_uri) | ||
|
|
||
| # Single org mode -- send them to the org-specific handler | ||
| if settings.SENTRY_SINGLE_ORGANIZATION: | ||
| return self.redirect_to_default_org_login() | ||
|
|
||
| session_expired = "session_expired" in request.COOKIES | ||
| if session_expired: | ||
| messages.add_message( | ||
| request=request, level=messages.WARNING, message=WARN_SESSION_EXPIRED | ||
| ) | ||
|
|
||
| if self.should_redirect_to_sso_login(request=request): | ||
| response = self.get_org_auth_login_redirect(request=request) | ||
| elif self.can_register(request=request): | ||
| response = self.get_registration_page(request=request, **kwargs) | ||
| else: | ||
| response = self.get_login_page(request=request, **kwargs) | ||
|
|
||
| if session_expired: | ||
| response.delete_cookie("session_expired") | ||
|
|
||
| return response | ||
|
|
||
| def get_next_uri(self, request: HttpRequest) -> str: | ||
| """ | ||
| Returns the next URI a user should visit in their authentication flow. | ||
| """ | ||
| next_uri_fallback = request.session.pop("_next", None) | ||
| return request.GET.get(REDIRECT_FIELD_NAME, next_uri_fallback) | ||
|
|
||
| def redirect_authenticated_user(self, request: HttpRequest, next_uri: str) -> HttpResponseBase: | ||
| """ | ||
| If an authenticated user sends a GET request to AuthLoginView, we redirect them forwards in the auth process. | ||
| """ | ||
| if not request.user.is_active: | ||
| return self.redirect(url=reverse("sentry-reactivate-account")) | ||
| if is_valid_redirect(url=next_uri, allowed_hosts=(request.get_host(),)): | ||
| return self.redirect(url=next_uri) | ||
| return self.redirect_to_org(request=request) | ||
|
|
||
| def redirect_to_default_org_login(self) -> HttpResponseRedirect: | ||
| """ | ||
| If Sentry is in single org mode this redirects users to their specific handler. | ||
| """ | ||
| org = organization_service.get_default_organization() | ||
| next_uri = reverse("sentry-auth-organization", args=[org.slug]) | ||
| return HttpResponseRedirect(redirect_to=next_uri) | ||
|
|
||
| def should_redirect_to_sso_login(self, request: HttpRequest) -> bool: | ||
| """ | ||
| Checks if a GET request to our login page should redirect to SSO login. | ||
| """ | ||
| non_sso_urls = [ | ||
| reverse("sentry-auth-organization", args=[request.subdomain]), | ||
| reverse("sentry-register"), | ||
| ] | ||
| return ( | ||
| bool(request.subdomain) | ||
| and self.org_exists(request=request) | ||
| and request.path_info not in non_sso_urls | ||
| ) | ||
| return self.handle_react(request) |
Contributor
There was a problem hiding this comment.
Inactive authenticated users no longer redirected to reactivate
AuthPageView.get() dropped the inactive-user redirect, so authenticated inactive sessions hit React auth_config nextUri and bounce between login and auth-required pages. Restore a redirect to sentry-reactivate-account for authenticated inactive users before handle_react, or return that nextUri from auth_config.respond_authenticated.
Evidence
- Former AuthLoginView.redirect_authenticated_user() redirected when
not request.user.is_activetosentry-reactivate-account; that branch was removed fromAuthPageView.get(). EmailAuthBackend.user_can_authenticate()always returns True, so inactive users keep authenticated sessions (test_reactivate_account.pylogs them in).- Protected views still treat inactive users as auth-required via
BaseView.is_auth_required()and send them to login. - React login assigns whatever
nextUriauth_config returns for authenticated users, andrespond_authenticated()never checksis_active.
Identified by Warden · sentry-backend-bugs · PUT-TQP
Member
Author
There was a problem hiding this comment.
Will get a separate fix in for this
evanpurkhiser
marked this pull request as ready for review
October 8, 2026 18:47
scttcper
approved these changes
Oct 8, 2026
wedamija
approved these changes
Oct 8, 2026
evanpurkhiser
deleted the
git/ref-auth-remove-legacy-organization-login-get-handling
branch
October 9, 2026 18:10
3 tasks done
This was referenced Oct 15, 2026
evanpurkhiser
added a commit
that referenced
this pull request
Oct 15, 2026
The megaphone SVG partial belonged to the legacy organization login page's “Request to Join” link. [#126712](#126712) deleted that page and its include when React authentication replaced the legacy login views. Remove the orphaned partial. Current sentry and getsentry code contain no render calls, includes, inheritance references, or template selectors consuming `sentry/partial/megaphone.html`.
evanpurkhiser
added a commit
that referenced
this pull request
Oct 15, 2026
The partner login banner became unreachable when #126712 removed the legacy login handler (`f397575c0ba`). That handler provided the sole `show_partner_login_banner` context value, based on the `partner` query parameter. An audit of sentry and getsentry found no remaining setters. Remove the conditional banner and its dedicated CSS from the alerts partial. Django flash-message rendering and its `sentry_helpers` dependency remain intact.
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
React authentication owns password login, registration, and MFA through the auth APIs. Replace the legacy login view with a React page entry point, remove its password registration and MFA forms, and delete the login, organization-login, auth-link-login, and two-factor templates.
Preserve customer-domain canonicalization, the organization SSO POST pipeline, and partner/channel destination handling. Identity-link GET requests resume canonical organization login with query parameters. The legacy /auth/2fa/ route sends pending MFA back to React while preserving session state, and still completes login when the user has no authenticators. Shared SSO account-confirmation and social-signup forms, the U2F app-ID endpoint, and sudo remain in use.
OAuth consent now uses canonical login via merged #126175. This incorporates the MFA cleanup from superseded #126711. The independent Vercel test update is https://github.com/getsentry/getsentry/pull/22365.
Follow-up frontend removals must deploy afterward: #126757 removes retired login LESS; #126761 removes the template bootstrap hook and rectangular indicator.
Validation: 302 backend authentication, channel-login, MFA, and OAuth tests passed on the combined change. 172 Getsentry tests and nine subtests passed on the combined change. Affected-view type checks and pre-commit checks passed. Six browser MFA tests passed on the combined cleanup, covering TOTP, refresh/resume, incorrect codes, recovery codes, SSO with MFA, and password-reset MFA. Seven login/registration/OAuth browser tests passed on the earlier login cleanup. Browser tests used existing compiled frontend assets.
The independent channel-login redirect encoding fix is tracked in #126862. Land that fix before this cleanup.
Land the inactive-session reactivation fix in #126936 before this cleanup, and preserve its web-entry redirect when rebasing.