Skip to content
Snippets Groups Projects
Commit 603eaac4 authored by sandeepsajan0's avatar sandeepsajan0 Committed by Fredrik Jonsson
Browse files

Update Backuptoken passwordform view and add custom setup view

parent e0be1fe4
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ from .views import ( ...@@ -13,6 +13,7 @@ from .views import (
TWOFABackupTokensPasswordView, TWOFABackupTokensPasswordView,
TWOFADisableView, TWOFADisableView,
TWOFARequiredMessageView, TWOFARequiredMessageView,
TWOFASetupView,
become, become,
create_password, create_password,
oauth, oauth,
...@@ -87,6 +88,7 @@ urlpatterns = [ ...@@ -87,6 +88,7 @@ urlpatterns = [
), ),
# Two factor redirect # Two factor redirect
path('two_factor/required/', TWOFARequiredMessageView.as_view(), name='two_factor_required'), path('two_factor/required/', TWOFARequiredMessageView.as_view(), name='two_factor_required'),
path('two_factor/setup/', TWOFASetupView.as_view(), name="two_factor_setup"),
path('two_factor/backup_tokens/password/', TWOFABackupTokensPasswordView.as_view(), name='backup_tokens_password'), path('two_factor/backup_tokens/password/', TWOFABackupTokensPasswordView.as_view(), name='backup_tokens_password'),
path('two_factor/disable/', TWOFADisableView.as_view(), name='disable'), path('two_factor/disable/', TWOFADisableView.as_view(), name='disable'),
path('two_factor/admin/disable/<str:user_id>/', TWOFAAdminDisableView.as_view(), name='admin_disable'), path('two_factor/admin/disable/<str:user_id>/', TWOFAAdminDisableView.as_view(), name='admin_disable'),
......
...@@ -24,6 +24,8 @@ from hijack.views import AcquireUserView ...@@ -24,6 +24,8 @@ from hijack.views import AcquireUserView
from two_factor.forms import AuthenticationTokenForm, BackupTokenForm from two_factor.forms import AuthenticationTokenForm, BackupTokenForm
from two_factor.views import DisableView as TwoFactorDisableView from two_factor.views import DisableView as TwoFactorDisableView
from two_factor.views import LoginView as TwoFactorLoginView from two_factor.views import LoginView as TwoFactorLoginView
from two_factor.views import SetupView as TwoFactorSetupView
from two_factor.views import BackupTokensView as TwoFactorBackupTokensView
from two_factor.utils import default_device from two_factor.utils import default_device
from wagtail.admin.views.account import password_management_enabled from wagtail.admin.views.account import password_management_enabled
from wagtail.core.models import Site from wagtail.core.models import Site
...@@ -284,7 +286,7 @@ def create_password(request): ...@@ -284,7 +286,7 @@ def create_password(request):
@method_decorator(login_required, name='dispatch') @method_decorator(login_required, name='dispatch')
class TWOFABackupTokensPasswordView(FormView): class TWOFABackupTokensPasswordView(TwoFactorBackupTokensView):
""" """
Require password to see backup codes Require password to see backup codes
""" """
...@@ -349,5 +351,9 @@ class TWOFAAdminDisableView(FormView): ...@@ -349,5 +351,9 @@ class TWOFAAdminDisableView(FormView):
return ctx return ctx
class TWOFASetupView(TwoFactorSetupView):
success_url = "users:backup_tokens_password"
class TWOFARequiredMessageView(TemplateView): class TWOFARequiredMessageView(TemplateView):
template_name = 'two_factor/core/two_factor_required.html' template_name = 'two_factor/core/two_factor_required.html'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment