@staticmethod<EOL><INDENT>def validate_redirect_url(next_url):<DEDENT>
if not next_url:<EOL><INDENT>return None<EOL><DEDENT>parts = urlparse(next_url)<EOL>if parts.netloc:<EOL><INDENT>domain, _ = split_domain_port(parts.netloc)<EOL>allowed_hosts = (['<STR_LIT:*>'] if django_settings.DEBUG<EOL>else django_settings.ALLOWED_HOSTS)<EOL>if not (domain and validate_host(domain, allowed_hosts)):<EOL><INDENT>return None<EOL><DEDENT><DEDENT>return urlunparse(("<STR_LIT>", "<STR_LIT>", parts.path,<EOL>parts.params, parts.query, parts.fragment))<EOL>
Returns the next_url path if next_url matches allowed hosts.