From 903702dfb1461cbb4ab93f841651e6882a72d337 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 16 Apr 2022 18:35:30 +0200 Subject: [PATCH] Removed unnecessary default argument from GET.get() call in LoginView.get_redirect_url(). The default argument is unnecessary because url_has_allowed_host_and_scheme() returns False when its first argument is "" or None, so get_redirect_url() still returns "". This also aligns LoginView.get_redirect_url() and LogoutView.get_next_page(). --- django/contrib/auth/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index 5de3989ffc..60e6611b98 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -74,7 +74,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView): def get_redirect_url(self): """Return the user-originating redirect URL if it's safe.""" redirect_to = self.request.POST.get( - self.redirect_field_name, self.request.GET.get(self.redirect_field_name, "") + self.redirect_field_name, self.request.GET.get(self.redirect_field_name) ) url_is_safe = url_has_allowed_host_and_scheme( url=redirect_to,