Address RemovedInDjango40Warning

This patch is a follow-up patch of 00def145de which renamed
is_safe_url() -> url_has_allowed_host_and_scheme() because
is_safe_url() is deprecated in Django 3.0.
For more info, please refer [1].

[1] https://docs.djangoproject.com/en/4.0/releases/3.0/#deprecated-features-3-0

Change-Id: I419f328916650093396fc153932a5053c3fa6b0e
This commit is contained in:
manchandavishal 2022-03-31 00:10:52 +05:30
parent 7284b4599e
commit 33efe3179d
1 changed files with 3 additions and 2 deletions

View File

@ -447,8 +447,9 @@ def switch_system_scope(request, redirect_field_name=auth.REDIRECT_FIELD_NAME):
# Ensure the user-originating redirection url is safe.
# Taken from django.contrib.auth.views.login()
redirect_to = request.GET.get(redirect_field_name, '')
if not http.is_safe_url(url=redirect_to,
allowed_hosts=[request.get_host()]):
if (not http.url_has_allowed_host_and_scheme(
url=redirect_to,
allowed_hosts=[request.get_host()])):
redirect_to = settings.LOGIN_REDIRECT_URL
if auth_ref: