<?php

use Dolphy\Plugin\Helpers\AdminPage;
use Dolphy\Plugin\Security\TwoFA;

defined('DOLPHY_PLUGIN') or die('Access Denied!');

add_action('show_user_profile', function ($user) {
  $twofa = TwoFA::get($user->ID);
  $status = ($twofa) ? 'Active' : 'Inactive';

  $page = AdminPage::url('security', '2fa');
  ?>
<h2>Dolphy Security</h2>

<table class="form-table">
  <tr>
    <th>
      <label for="dolphy-2fa">Two-Factor Authentication</label>
    </th>
    <td>
      <p><strong><?php echo $status; ?>:</strong> Dolphy 2FA is <?php echo strtolower($status); ?>.</p>
      <p>
        <a href="<?php echo esc_url($page); ?>" class="button">
          <?php echo ($twofa) ? 'Manage' : 'Activate'; ?> 2FA
        </a>
      </p>
    </td>
  </tr>
</table>
  <?php
}, 10, 1);

// edit_user_profile
