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

configure_mfa_with_form actually adds an mfa method - does not clear existing #81

Open
yahiakala opened this issue Mar 10, 2024 · 0 comments

Comments

@yahiakala
Copy link

yahiakala commented Mar 10, 2024

The alert message implies that the function configure_mfa_with_form clears existing mfa methods. However, it appends the new mfa method to the existing ones, since the function add_mfa_method is not called with clear_existing=True

It should say something like "You have successfully added a two-factor authentication method".
Or, more flexibly, it should have the option clear_existing which will then affect the append/clear and also the alert message.

`

    def configure_mfa_with_form(allow_cancel=False):

        error = None
        while True:
            mfa_method, password = _configure_mfa(None, error, True, allow_cancel, "Save")

            if mfa_method:
                try:
                    add_mfa_method(password, mfa_method)
                    alert("Your two-factor authentication configuration has been reset.")
                    return True
                except AuthenticationFailed as e:
                    error = e.args[0]
                except Exception as e:
                    error = str(e)
            else:
                return None

`

Happy to do a PR if you like :)

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

No branches or pull requests

1 participant