Files
wallabag/templates/Config/otp_app.html.twig
Kevin Decherf b09224cac1 Add a two-step setup of OTP
Before this change, 2FA with OTP was enabled before the user was able to
submit a code to validate the setup. Thus, this could lead to a
situation where the user is locked out of her account if there was an
issue setting up her application.

Now we rely on a new boolean property that is set to true only after the
user submits a valid code during the setup phase.

Fixes #4867

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2025-07-28 22:58:43 +02:00

63 lines
3.1 KiB
Twig

{% extends "layout.html.twig" %}
{% block title %}{{ 'config.page_title'|trans }} > {{ 'config.otp.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
<div class="row">
<h5>{{ 'config.otp.page_title'|trans }}</h5>
<ol>
<li>
<p>{{ 'config.otp.app.two_factor_code_description_1'|trans }}</p>
<p>{{ 'config.otp.app.two_factor_code_description_2'|trans }}</p>
<p>
<img data-controller="qrcode" data-qrcode-url-value="{{ qr_code|raw }}" class="hide-on-med-and-down" />
</p>
<div id="config_otp_app_secret">
{{ 'config.otp.app.two_factor_code_description_5'|trans }} <pre><code>{{ secret }}</code></pre>
</div>
</li>
<li>
<p>{{ 'config.otp.app.two_factor_code_description_3'|trans }}</p>
<div><pre><code>{{ backupCodes|join("\n") }}</code></pre></div>
</li>
<li>
<p>{{ 'config.otp.app.two_factor_code_description_4'|trans }}</p>
{% for flash_message in app.session.flashbag.get("two_factor") %}
<div class="card-panel red darken-1 black-text">
{{ flash_message|trans }}
</div>
{% endfor %}
<form class="form" action="{{ path("config_otp_app_check") }}" method="post" name="config_otp_app_check">
<input type="hidden" name="token" value="{{ csrf_token('otp') }}" />
<div class="card-content">
<div class="row">
<div class="input-field col s12">
<label for="_auth_code">{{ "auth_code"|trans({}, 'SchebTwoFactorBundle') }}</label>
<input id="_auth_code" type="text" autocomplete="off" name="_auth_code" required="required" />
</div>
</div>
</div>
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="send">
{{ 'config.otp.app.enable'|trans }}
<i class="material-icons right">send</i>
</button>
</div>
</form>
</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}