remotes/1693045480750635534/spooky-22
Aevann1 2022-01-16 04:47:37 +02:00
parent 50ea9b01f6
commit 1920cd2ace
2 changed files with 69 additions and 67 deletions

View File

@ -164,6 +164,75 @@
</div>
{% if request.path == '/settings/security' %}
<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 role="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% if mfa_secret %}
<div>
<form action="/settings/security" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" type="hidden" name="2fa_secret" value="{{mfa_secret}}">
<div class="modal-body">
<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}}">
<pre></pre>
<div class="text-small text-muted">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('enable2faButton').disabled=false" required>
</div>
<div class="modal-footer">
<button role="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<input autocomplete="off" id="enable2faButton" class="btn btn-primary" type="submit" value="Enable 2-step login" disabled>
</div>
</form>
</div>
{% else %}
<div>
<form action="/settings/security" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" type="hidden" name="2fa_secret" value="{{mfa_secret}}">
<div class="modal-body">
<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('disable2faButton').disabled=false" required>
</div>
<div class="modal-footer">
<button role="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<input autocomplete="off" id="disable2faButton" class="btn btn-primary" type="submit" value="Disable 2-step login" disabled>
</div>
</form>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% block clipboard %}
<div class="toast clipboard" id="toast-success" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">

View File

@ -262,71 +262,4 @@
</div>
</div>
<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 role="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% if mfa_secret %}
<div>
<form action="/settings/security" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" type="hidden" name="2fa_secret" value="{{mfa_secret}}">
<div class="modal-body">
<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}}">
<pre></pre>
<div class="text-small text-muted">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('enable2faButton').disabled=false" required>
</div>
<div class="modal-footer">
<button role="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<input autocomplete="off" id="enable2faButton" class="btn btn-primary" type="submit" value="Enable 2-step login" disabled>
</div>
</form>
</div>
{% else %}
<div>
<form action="/settings/security" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" type="hidden" name="2fa_secret" value="{{mfa_secret}}">
<div class="modal-body">
<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('disable2faButton').disabled=false" required>
</div>
<div class="modal-footer">
<button role="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<input autocomplete="off" id="disable2faButton" class="btn btn-primary" type="submit" value="Disable 2-step login" disabled>
</div>
</form>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}