1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #4766: Fix redirect after login when next is not specified

This commit is contained in:
Jeremy Stretch
2020-06-17 09:15:03 -04:00
parent 7cf0e6034b
commit e23a5ad141
2 changed files with 9 additions and 1 deletions

View File

@ -50,7 +50,7 @@ class LoginView(View):
logger.debug("Login form validation was successful")
# Determine where to direct user after successful login
redirect_to = request.POST.get('next')
redirect_to = request.POST.get('next', reverse('home'))
if redirect_to and not is_safe_url(url=redirect_to, allowed_hosts=request.get_host()):
logger.warning(f"Ignoring unsafe 'next' URL passed to login form: {redirect_to}")
redirect_to = reverse('home')