Skip to content

Commit

Permalink
ref: fix typing for sentry.web.frontend.twofactor (#81842)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored Dec 9, 2024
1 parent a696ed1 commit 5209017
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ module = [
"sentry.web.frontend.react_page",
"sentry.web.frontend.setup_wizard",
"sentry.web.frontend.shared_group_details",
"sentry.web.frontend.twofactor",
"sentry_plugins.bitbucket.client",
"sentry_plugins.bitbucket.mixins",
"sentry_plugins.github.plugin",
Expand Down
7 changes: 3 additions & 4 deletions src/sentry/web/frontend/twofactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext as _
from rest_framework.request import Request

from sentry import options
from sentry import ratelimits as ratelimiter
Expand All @@ -32,7 +31,7 @@
class TwoFactorAuthView(BaseView):
auth_required = False

def perform_signin(self, request: Request, user, interface=None):
def perform_signin(self, request: HttpRequest, user, interface=None):
assert auth.login(request, user, passed_2fa=True)
rv = HttpResponseRedirect(auth.get_login_redirect(request))
if interface is not None:
Expand All @@ -46,12 +45,12 @@ def perform_signin(self, request: Request, user, interface=None):
)
return rv

def fail_signin(self, request: Request, user, form):
def fail_signin(self, request: HttpRequest, user, form):
# Ladies and gentlemen: the world's second-worst bruteforce prevention.
time.sleep(2.0)
form.errors["__all__"] = [_("Invalid confirmation code. Try again.")]

def negotiate_interface(self, request: Request, interfaces):
def negotiate_interface(self, request: HttpRequest, interfaces):
# If there is only one interface, just pick that one.
if len(interfaces) == 1:
return interfaces[0]
Expand Down

0 comments on commit 5209017

Please sign in to comment.