Open redirect fix after login

This is just to make sure after login you are just redirecting to a path not another domain.
This commit is contained in:
pelle 2022-08-08 09:53:25 -06:00 committed by GitHub
parent 90317adae7
commit 3f49225eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,7 @@ class LoginView(View):
data = request.POST if request.method == "POST" else request.GET
redirect_url = data.get('next', settings.LOGIN_REDIRECT_URL)
if redirect_url and redirect_url.startswith('/'):
if redirect_url and redirect_url.startswith('/') and not redirect_url.startswith('//'):
logger.debug(f"Redirecting user to {redirect_url}")
else:
if redirect_url: