Skip to content
Snippets Groups Projects
Verified Commit 4e374441 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

[2FA] Set correct name for phone devices

parent b7600044
No related branches found
No related tags found
1 merge request!1099Activate WebAuthn and redesign 2FA profile page
......@@ -1521,6 +1521,16 @@ class TwoFactorSetupView(two_factor_views.SetupView):
def get(self, request, *args, **kwargs):
return super(two_factor_views.SetupView, self).get(request, *args, **kwargs)
def get_device(self, **kwargs):
device = super().get_device(**kwargs)
# Ensure that the device is named "backup" if it is a phone device
# to ensure compatibility with django_two_factor_auth
method = self.get_method()
if device and method.code in ("call", "sms"):
device.name = "backup"
return device
class TwoFactorLoginView(two_factor_views.LoginView):
def get_devices(self):
......
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