{% extends "vantage/base.html" %} {% load i18n %} {% comment %} Four states, one page: newly issued recovery codes; on; being set up; off. The secret appears only in the "being set up" state, and only for the account that is setting it up. Once a code has confirmed it, nothing in the panel renders it again — recovering it means switching two-factor sign-in off and setting it up afresh. The recovery codes appear only in the response that created them. The page is sent with Cache-Control: no-store, so the back button does not bring them back either. {% endcomment %} {% block content %}

{{ page_title }}

{{ page_description }}

{% if new_codes %}

{% translate "Save your recovery codes" %}

{% if just_enabled %}

{% translate "Two-factor sign-in is now on." %}

{% endif %}

{% blocktranslate trimmed %} Each code signs you in once if you lose your phone. Keep them somewhere safe, such as a password manager. They will not be shown again. {% endblocktranslate %}

{% translate "I have saved them" %}
{% elif enrol %}

{% if device %}{% blocktranslate trimmed with name=pending.name %}Add {{ name }}{% endblocktranslate %}{% else %}{% translate "Set up your authenticator app" %}{% endif %}

  1. {% blocktranslate trimmed %} In an authenticator app — Google Authenticator, Microsoft Authenticator, 1Password, Bitwarden or any other that supports time-based codes — add an account and scan this code. {% endblocktranslate %}

    {% if enrol.qr %}
    {{ enrol.qr }}
    {% endif %}

    {% if device %}{% blocktranslate trimmed with issuer=enrol.issuer name=pending.name %} Cannot scan it? Choose to enter a key instead, name the entry something you will recognise, such as {{ issuer }} ({{ name }}), and type: {% endblocktranslate %}{% else %}{% blocktranslate trimmed with issuer=enrol.issuer %} Cannot scan it? Choose to enter a key instead, name it {{ issuer }}, and type: {% endblocktranslate %}{% endif %}

    {{ enrol.key }}

    {% translate "Or open it in an authenticator app on this device" %}

  2. {% if confirm_form.non_field_errors %} {% endif %}
    {% csrf_token %} {% if next %}{% endif %} {% with field=confirm_form.code %}
    {{ field }}

    {{ field.help_text }}

    {% if field.errors %} {% endif %}
    {% endwith %}
{% csrf_token %} {% if next %}{% endif %}
{% elif device %}

{% translate "Two-factor sign-in is on" %}

{% blocktranslate trimmed %} After your password, you are asked for a code from any of your authenticator apps below. Each change on this page asks you to confirm it is you, with a current code or your password. {% endblocktranslate %}

{% translate "Your devices" %}

{% blocktranslate trimmed count counter=remaining %} {{ counter }} recovery code left. {% plural %} {{ counter }} recovery codes left. {% endblocktranslate %}

{% if may_add %}

{% translate "Add a device" %}

{% csrf_token %} {% with field=name_form.name %}
{{ field }}

{{ field.help_text }}

{% endwith %} {% include "vantage/partials/two_factor_proof.html" with section="start" %}
{% endif %}

{% translate "Recovery codes" %}

{% translate "Replacing them makes the old ones stop working." %}

{% csrf_token %} {% include "vantage/partials/two_factor_proof.html" with section="codes" %}

{% translate "Switch off two-factor sign-in" %}

{% translate "This removes every device and all recovery codes, and your account goes back to a password alone." %} {% if required %} {% translate "Your role requires two-factor sign-in, so switching it off takes you straight back to setting it up." %} {% endif %}

{% csrf_token %} {% include "vantage/partials/two_factor_proof.html" with section="disable" %}
{% else %}

{% translate "Two-factor sign-in is off" %}

{% if required %} {% endif %}

{% blocktranslate trimmed %} With it on, signing in takes your password and a code from an app on your phone, so a leaked password is not enough on its own. {% endblocktranslate %}

{% csrf_token %} {% if next %}{% endif %}
{% endif %} {% endblock %}