# HG changeset patch # User Yader Velasquez # Date 1614791992 21600 # Wed Mar 03 11:19:52 2021 -0600 # Node ID ff47aa83337e8c8795fb960fbeb779766c6ccd88 # Parent ec8a1e3db30e44ac025e6c8bcd81cb7235ad7e0e Fix next url when there is only one org diff --git a/nlotp/middleware.py b/nlotp/middleware.py --- a/nlotp/middleware.py +++ b/nlotp/middleware.py @@ -31,6 +31,8 @@ return None if request.path not in settings.NLOTP_VERIFY_EXCLUDED_URLS: next_url = request.GET.get(REDIRECT_FIELD_NAME) + if not next_url: + next_url = request.path return HttpResponseRedirect( '{0}?{1}={2}'.format(settings.NLOTP_VERIFY_URL, REDIRECT_FIELD_NAME, next_url)