Address RemovedInDjango40Warning
This patch is a follow-up patch of 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]
@@ -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:
