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:
@ -1,5 +1,13 @@
|
|||||||
# NetBox v2.8
|
# NetBox v2.8
|
||||||
|
|
||||||
|
## v2.8.7 (FUTURE)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#4766](https://github.com/netbox-community/netbox/issues/4766) - Fix redirect after login when `next` is not specified
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## v2.8.6 (2020-06-15)
|
## v2.8.6 (2020-06-15)
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
@ -50,7 +50,7 @@ class LoginView(View):
|
|||||||
logger.debug("Login form validation was successful")
|
logger.debug("Login form validation was successful")
|
||||||
|
|
||||||
# Determine where to direct user after successful login
|
# 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()):
|
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}")
|
logger.warning(f"Ignoring unsafe 'next' URL passed to login form: {redirect_to}")
|
||||||
redirect_to = reverse('home')
|
redirect_to = reverse('home')
|
||||||
|
Reference in New Issue
Block a user