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

Build-in support for many different methods instead of only default #743

Open
rafsaf opened this issue Nov 8, 2024 · 1 comment
Open

Comments

@rafsaf
Copy link

rafsaf commented Nov 8, 2024

Expected Behavior

Users should be given an option to setup more methods instead of only primary method.

Current Behavior

When user setup for example yubikey, then in two_factor view sees "Primary method: Use your Yubikey device" and setup for another methods is not possible.

In setup this is clearly visible that this is intentional disabled:

def get(self, request, *args, **kwargs):
"""
Start the setup wizard. Redirect if already enabled.
"""
if default_device(self.request.user):
return redirect(self.get_success_url())
return super().get(request, *args, **kwargs)

However, in login view, many different methods are handled if they exist, for example created in custom form or via admin panel

def get_context_data(self, form, **kwargs):
"""
Adds user's default and backup OTP devices to the context.
"""
context = super().get_context_data(form, **kwargs)
if self.steps.current == self.TOKEN_STEP:
device = self.get_device()
context['device'] = device
context['other_devices'] = self.get_other_devices(device)

And here how it looks when i add more methods in admin panel:

image

Possible Solution

Allow users to setup 2fa many times. It's already handled in login so that's for free and could be supported in account and setup views with relatively moderate code changes. Note that I am not sure why is it not a case, maybe there are some non trivial things to consider or breaking changes like that are not acceptable for some reason.

Context

For yubikey setup for eaxmple it totally makes sense and is popular to have 2 or more different keys for example one dedicated to pc, second to laptop and alternatively some backup one.

@moggers87
Copy link
Collaborator

Sounds good, we would ideally want this either as part of or after #347

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants