Live Chat

We'll need to share your messages (and your email address if you're logged in) with our live chat provider, Drift. Here's their privacy policy.

If you don't want to do this, you can email us instead at contact@anvil.works.

anvil.users.mfa Module

Functions

add_mfa_method(password, mfa_method, [clear_existing=False])

Add an MFA method to the current user by passing the user’s password and the mfa method, optionally clearing all existing methods.


configure_mfa_with_form([allow_cancel=False])

Display a form for the user to configure 2-factor authentication.

allow_cancel: if True, the signup form has a Cancel button that the user can use to dismiss the form.


create_fido_mfa_method(email_address)

Generate a WebAuthn challenge that can be used to register a new hardware token for two-factor authentication.


generate_totp_secret(email_address)

Generate a TOTP secret that can be added as two-factor authentication for the current user.


get_available_mfa_types(email_address, password)

Get the available MFA types for the given user by passing their email and password.


get_fido_mfa_login(email_address, password)

Generate a WebAuthn challenge that the given user can use to log in with a previously registered hardware token.


get_totp_mfa_login(code)

Get an MFA login object representing a TOTP login code. This can be passed to the login_with_email function as the mfa argument.


mfa_login_with_form(email_address, password)

Display a form to collect two-factor authentication credentials from the user currently logging in by passing the function their email and password.


validate_totp_code(mfa_method, code)

Validate the given TOTP code against the given MFA method from a User row.



anvil.users.mfa