View Source Bonfire.Me.Accounts.SecondFactors (bonfire v0.3.5-classic-beta.10)

Link to this section Summary

Functions

Sets or updates the TOTP secret. The secret is a random 20 bytes binary that is used to generate the QR Code to enable 2FA using auth applications. It will only be updated if the OTP code sent is valid.

Disables the TOTP configuration for the given account.

Gets the %AuthSecondFactor{} entry, if any.

Validates if the given TOTP code is valid.

Link to this section Functions

Link to this function

changeset(totp \\ %AuthSecondFactor{}, attrs, opts \\ [])

View Source

Sets or updates the TOTP secret. The secret is a random 20 bytes binary that is used to generate the QR Code to enable 2FA using auth applications. It will only be updated if the OTP code sent is valid.

examples

Examples

iex> changeset(%AuthSecondFactor{secret: <<...>>}, code: "123456")
%Ecto.Changeset{data: %AuthSecondFactor{}}
Link to this function

delete_account_totp(account_totp)

View Source

Disables the TOTP configuration for the given account.

Link to this function

get_account_totp(account)

View Source

Gets the %AuthSecondFactor{} entry, if any.

Link to this function

maybe_authenticate(account, params)

View Source
Link to this function

maybe_cast_totp_changeset(changeset, params, opts)

View Source
Link to this function

new_struct(secret \\ nil)

View Source
Link to this function

validate_account_totp(totp, code)

View Source

Validates if the given TOTP code is valid.