diff --git a/loginpass/_django.py b/loginpass/_django.py index 4a1e02b..3619bc8 100644 --- a/loginpass/_django.py +++ b/loginpass/_django.py @@ -60,6 +60,7 @@ def auth(request): def create_login_endpoint(remote, backend, auth_route_name): + from urllib.parse import urlencode from django.conf import settings from django.urls import reverse @@ -72,8 +73,11 @@ def create_login_endpoint(remote, backend, auth_route_name): def login(request): redirect_uri = request.build_absolute_uri(reverse(auth_route_name)) + if 'next' in request.GET: + redirect_uri += '?'+urlencode({'next': request.GET['next']}) + params = {} if authorize_params: - params.udpate(authorize_params) + params.update(authorize_params) return remote.authorize_redirect(request, redirect_uri, **params) return login