Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for chaining the next parameter into the setup view. #622

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions two_factor/views/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import time
import urllib.parse
import warnings
from base64 import b32encode
from binascii import unhexlify
Expand Down Expand Up @@ -185,8 +186,15 @@ def done(self, form_list, **kwargs):
# If the user does not have a device.
elif OTPRequiredMixin.is_otp_view(self.request.GET.get('next')):
if self.request.GET.get('next'):
self.request.session['next'] = self.get_success_url()
return redirect('two_factor:setup')
return redirect(
'{view_url}?{query_string}'.format(
view_url=reverse('two_factor:setup'),
query_string=urllib.parse.urlencode({
'next': self.get_success_url()
})
))
else:
return redirect('two_factor:setup')

return response

Expand Down