rDrama/files/templates/modals/2fa.html

55 lines
3.0 KiB
HTML

<div class="modal fade" id="2faModal" tabindex="-1" role="dialog" aria-labelledby="2faModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{% if mfa_secret %}
Setup two-step login
{% elif mfa_secret and not v.email %}
Email required for two-step login
{% else %}
Disable two-step login
{% endif %}
</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
<form action="/settings/security" method="post">
<input type="hidden" name="formkey" value="{{v|formkey}}">
<input type="hidden" name="2fa_secret" value="{{mfa_secret}}">
<div class="modal-body">
{% if mfa_secret %}
<p><span class="font-weight-bold">Step 1:</span> Scan this barcode (or enter the code) using a two-factor authentication app such as Google Authenticator or Authy.</p>
<div class="text-center mb-3">
<img alt="two-factor QR code" loading="lazy" class="img-fluid" width=175 src="/2faqr/{{mfa_secret}}">
<div class="text-small text-muted mt-1">Or enter this code: {{mfa_secret}}</div>
</div>
<p><span class="font-weight-bold">Step 2:</span> Enter the six-digit code generated in the authenticator app and your {{SITE_NAME}} account password.</p>
<label for="2fa_input">6-digit code</label>
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_token" placeholder="# # # # # #" required>
<label for="2fa_input_password">Password</label>
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" oninput="document.getElementById('toggle2faButton').disabled=false" required>
{% else %}
<div class="alert alert-warning" role="alert">
<i class="fas fa-info-circle"></i>
To disable two-step login, please enter your {{SITE_NAME}} account password and the 6-digit code generated in your authentication app. If you no longer have your two-step device, <a href="/lost_2fa">click here</a>.
</div>
<label for="2fa_input_password">Password</label>
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" required>
<label for="2fa_input">6-digit code</label>
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_remove" placeholder="# # # # # #" oninput="document.getElementById('toggle2faButton').disabled=false" required>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<input autocomplete="off" id="toggle2faButton" class="btn btn-primary" type="submit" onclick="disable(this)" value="Enable 2-step login" disabled>
</div>
</form>
</div>
</div>
</div>