Updates 2fa templates

main
Yasen Pramatarov 2025-04-08 10:29:21 +03:00
parent 7b7e44faf2
commit 947a4e39c5
3 changed files with 11 additions and 12 deletions

View File

@ -22,7 +22,7 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($setupData)): ?> <?php if (isset($setupData) && is_array($setupData)): ?>
<div class="setup-steps"> <div class="setup-steps">
<h4>1. Install an authenticator app</h4> <h4>1. Install an authenticator app</h4>
<p>If you haven't already, install an authenticator app on your mobile device:</p> <p>If you haven't already, install an authenticator app on your mobile device:</p>
@ -46,7 +46,7 @@
<h4 class="mt-4">3. Verify setup</h4> <h4 class="mt-4">3. Verify setup</h4>
<p>Enter the 6-digit code from your authenticator app to verify the setup:</p> <p>Enter the 6-digit code from your authenticator app to verify the setup:</p>
<form method="post" action="?page=credentials&action=setup" class="mt-3"> <form method="post" action="?page=credentials&item=2fa&action=setup" class="mt-3">
<div class="form-group"> <div class="form-group">
<input type="text" <input type="text"
name="code" name="code"
@ -58,6 +58,7 @@
</div> </div>
<input type="hidden" name="secret" value="<?php echo htmlspecialchars($setupData['secret']); ?>"> <input type="hidden" name="secret" value="<?php echo htmlspecialchars($setupData['secret']); ?>">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>">
<button type="submit" class="btn btn-primary mt-3"> <button type="submit" class="btn btn-primary mt-3">
Verify and enable 2FA Verify and enable 2FA
@ -82,12 +83,10 @@
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<form method="post" action="?page=credentials&action=setup" class="mt-3"> <div class="alert alert-danger">
<p>Click the button below to begin setting up two-factor authentication:</p> Failed to generate 2FA setup data. Please try again.
<button type="submit" class="btn btn-primary"> </div>
Begin setup <a href="?page=credentials" class="btn btn-primary">Back to credentials</a>
</button>
</form>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
@ -95,7 +94,7 @@
</div> </div>
</div> </div>
<?php if (!empty($setupData)): ?> <?php if (isset($setupData) && is_array($setupData)): ?>
<script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {

View File

@ -20,7 +20,7 @@
<p>Enter the 6-digit code from your authenticator app:</p> <p>Enter the 6-digit code from your authenticator app:</p>
<form method="post" action="?page=credentials&action=verify" class="mt-3"> <form method="post" action="?page=login&action=verify" class="mt-3">
<div class="form-group"> <div class="form-group">
<input type="text" <input type="text"
name="code" name="code"
@ -50,7 +50,7 @@
</p> </p>
<div class="collapse mt-3" id="backupCodeForm"> <div class="collapse mt-3" id="backupCodeForm">
<form method="post" action="?page=credentials&action=verify" class="mt-3"> <form method="post" action="?page=login&action=verify" class="mt-3">
<div class="form-group"> <div class="form-group">
<label>Enter backup code:</label> <label>Enter backup code:</label>
<input type="text" <input type="text"

View File

@ -77,7 +77,7 @@
<div class="alert alert-warning"> <div class="alert alert-warning">
<i class="fas fa-exclamation-triangle"></i> two-factor authentication is not enabled <i class="fas fa-exclamation-triangle"></i> two-factor authentication is not enabled
</div> </div>
<form method="post" action="?page=credentials&item=2fa&action=edit"> <form method="post" action="?page=credentials&item=2fa&action=setup">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>"> <input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
set up two-factor authentication set up two-factor authentication