@@ -43,7 +43,6 @@ def redirect_to_mfa_setup(self, request):
4343 # have MFA enabled on their account. We're going to redirect them
4444 # to the MFA setup.
4545
46- # TODO: Add redirect_to functionality to MFA setup.
4746 # TODO: Add message indicating why the user was directed or setup and MFA required
4847 # interstitial page to explain to the user they need to setup MFA.
4948 setup_url = reverse ('two_factor:setup' )
@@ -133,32 +132,3 @@ class AdminSiteOTPRequired(TwoFactorAdminSite):
133132 warnings .warn ('AdminSiteOTPRequired is deprecated by TwoFactorAdminSite, please update.' ,
134133 category = DeprecationWarning )
135134 pass
136-
137-
138- def patch_admin ():
139- warnings .warn ('two-factor admin patching will be removed, use TwoFactorAdminSite or TwoFactorAdminSiteMixin.' ,
140- category = DeprecationWarning )
141- # overrides
142- setattr (AdminSite , 'login' , TwoFactorAdminSiteMixin .login )
143- setattr (AdminSite , 'admin_view' , TwoFactorAdminSiteMixin .admin_view )
144- setattr (AdminSite , 'has_permission' , TwoFactorAdminSiteMixin .has_permission )
145- # additions
146- setattr (AdminSite , 'has_admin_permission' , original_has_permission )
147- setattr (AdminSite , 'has_mfa_setup' , TwoFactorAdminSiteMixin .has_mfa_setup )
148- setattr (AdminSite , 'redirect_to_mfa_setup' , TwoFactorAdminSiteMixin .redirect_to_mfa_setup )
149-
150-
151- def unpatch_admin ():
152- warnings .warn ('django-two-factor admin patching is deprecated, use TwoFactorAdminSite or TwoFactorAdminSiteMixin.' ,
153- category = DeprecationWarning )
154- # we really only need unpatching in our tests so this can be a noop.
155- # overrides
156- setattr (AdminSite , 'login' , original_login )
157- setattr (AdminSite , 'admin_view' , original_admin_view )
158- setattr (AdminSite , 'has_permission' , original_has_permission )
159- # NOTE: this unpatching doesn't really work, but becuase it just patches in our mixin it isn't harmful.
160-
161-
162- original_login = AdminSite .login
163- original_admin_view = AdminSite .admin_view
164- original_has_permission = AdminSite .has_permission
0 commit comments