<?= $this->extend('layouts/auth') ?>

<?= $this->section('content') ?>

<p class="text-muted small mb-4">Enter your username or email and we'll send you a link to reset your password.</p>

<?php if (session()->getFlashdata('errors')): ?>
    <div class="alert alert-danger py-2 small">
        <ul class="mb-0 ps-3">
            <?php foreach (session()->getFlashdata('errors') as $err): ?>
                <li><?= esc($err) ?></li>
            <?php endforeach; ?>
        </ul>
    </div>
<?php endif; ?>

<form action="<?= base_url('password/forgot') ?>" method="post" novalidate>
    <?= csrf_field() ?>

    <div class="mb-4">
        <label for="identifier" class="form-label">Username or Email</label>
        <input type="text" class="form-control" id="identifier" name="identifier" value="<?= esc(old('identifier')) ?>" autofocus required>
    </div>

    <button type="submit" class="btn btn-primary w-100 mb-3">Send Reset Link</button>
    <a href="<?= base_url('login') ?>" class="d-block text-center small">Back to sign in</a>
</form>

<?= $this->endSection() ?>
