diff --git a/src/pretix/control/templates/pretixcontrol/user/2fa_confirm_totp.html b/src/pretix/control/templates/pretixcontrol/user/2fa_confirm_totp.html index 7a1eb15a50..d618cfc643 100644 --- a/src/pretix/control/templates/pretixcontrol/user/2fa_confirm_totp.html +++ b/src/pretix/control/templates/pretixcontrol/user/2fa_confirm_totp.html @@ -38,6 +38,37 @@
  • {% trans "Add a new account to the app by scanning the following barcode:" %}
    +

    + + {% trans "Can't scan the barcode?" %} + +

    +
    +
      +
    1. + {% trans "Use the \"provide a key\" option of your authenticator app." %} +
    2. +
    3. + {% trans "In \"Account name\", type your login name for pretix." %} +
    4. +
    5. + {% trans "In \"Secret\"/\"Account Key\", enter the following code:" %} +
      + {{ secretGrouped }} + +
      +
      + Spaces don't matter. +
      +
    6. +
    7. + {% trans "If present, make sure \"Time-based\"/\"TOTP\" and 6 digit codes are selected." %} +
    8. +
    +
  • {% trans "Enter the displayed code here:" %} diff --git a/src/pretix/control/views/user.py b/src/pretix/control/views/user.py index ff81d2fb67..2b1d04518e 100644 --- a/src/pretix/control/views/user.py +++ b/src/pretix/control/views/user.py @@ -262,6 +262,7 @@ class User2FADeviceConfirmTOTPView(RecentAuthenticationRequiredMixin, TemplateVi ctx = super().get_context_data() ctx['secret'] = base64.b32encode(self.device.bin_key).decode('utf-8') + ctx['secretGrouped'] = " ".join([ctx['secret'].lower()[(i * 4): (i + 1) * 4] for i in range(len(ctx['secret']) // 4)]) ctx['qrdata'] = 'otpauth://totp/{label}%3A%20{user}?issuer={label}&secret={secret}&digits={digits}'.format( label=quote(settings.PRETIX_INSTANCE_NAME), user=quote(self.request.user.email), secret=ctx['secret'],