Skip to content Skip to footer navigation

User-two_factor_recovery_codes_download_url Tag

Overview#

The user:two_factor_recovery_codes_download_url tag outputs a URL that allows the authenticated user to download their recovery codes as a plain text file. This provides a convenient way for users to save their codes offline.

Hot Tip!

This tag requires the user to be authenticated with 2FA enabled. If 2FA is not enabled, the tag returns an empty string.

A troll pointing a teaching stick

Example#

{{ if {user:two_factor_enabled} }}
<a href="{{ user:two_factor_recovery_codes_download_url }}">
Download Recovery Codes
</a>
{{ /if }}
@if (Statamic::tag('user:two_factor_enabled')->fetch())
<a href="{{ Statamic::tag('user:two_factor_recovery_codes_download_url')->fetch() }}">
Download Recovery Codes
</a>
@endif
Hot Tip!

{{ user:two_factor_enabled }} is a tag, not a variable, so conditionals need the extra braces: {{ if {user:two_factor_enabled} }}.

A troll pointing a teaching stick