certimine/views/lookup.php
remaster 84e94dcb55 seguridad: token DC3 vía env, config o config/token.php (gitignored)
- Elimina lectura del token desde DatosPdf; nuevo token.example.php y token.php ignorado.
- DatosPdf.txt deja de versionarse; docs/DatosPdf.example.txt con TOKEN redactado.
- Ajusta README, docs API, i18n y banderolas de consulta/diagnóstico previos.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 18:49:11 -06:00

66 lines
2.7 KiB
PHP

<?php
declare(strict_types=1);
use CertiMine\Config;
use CertiMine\I18n;
use CertiMine\Security;
use CertiMine\Util;
/** @var string|null $error */
/** @var bool $lookupDc3Ok */
/** @var bool $lookupDc3Env */
/** @var bool $lookupUsingExample */
/** @var string $lookupDc3Base */
require __DIR__ . '/partials/header.php';
?>
<h1 class="h3 mb-3"><?= Util::h(I18n::t('lookup_title')) ?></h1>
<p class="text-muted"><?= Util::h(I18n::t('lookup_intro')) ?></p>
<?php if (!$lookupDc3Ok): ?>
<div class="alert alert-warning border-0 shadow-sm" role="status">
<span class="material-symbols-outlined align-middle">warning</span>
<strong><?= Util::h(I18n::t('lookup_need_dc3_title')) ?></strong><br>
<?= Util::h(I18n::t('lookup_need_dc3_body')) ?>
<?php if ($lookupUsingExample): ?>
<br><span class="small text-muted"><?= Util::h(I18n::t('lookup_using_example_config')) ?></span>
<?php endif; ?>
</div>
<?php else: ?>
<div class="alert alert-success border-0 shadow-sm py-2" role="status">
<span class="material-symbols-outlined align-middle">cloud_done</span>
<?= Util::h(I18n::t('lookup_dc3_ready')) ?>
<span class="small text-muted d-block mt-1">
<?= Util::h($lookupDc3Base) ?>
<?php if ($lookupDc3Env): ?> — <?= Util::h(I18n::t('lookup_token_env')) ?><?php else: ?> — <?= Util::h(I18n::t('lookup_token_config')) ?><?php endif; ?>
</span>
</div>
<?php endif; ?>
<?php if (Config::debugMode()): ?>
<div class="alert alert-secondary small"><?= Util::h(I18n::t('lookup_debug_hint')) ?></div>
<?php endif; ?>
<?php if ($error): ?>
<div class="alert alert-danger"><?= Util::h($error) ?></div>
<?php endif; ?>
<form method="post" class="card p-4 mb-3" style="max-width:520px">
<input type="hidden" name="_csrf" value="<?= Util::h(Security::csrfToken()) ?>">
<div class="mb-3">
<label class="form-label"><?= Util::h(I18n::t('lookup_type')) ?></label>
<select name="person_type" class="form-select">
<option value="employee"><?= Util::h(I18n::t('lookup_employee')) ?></option>
<option value="contractor"><?= Util::h(I18n::t('lookup_contractor')) ?></option>
</select>
</div>
<div class="mb-3">
<label class="form-label"><?= Util::h(I18n::t('lookup_code')) ?></label>
<input class="form-control" name="code" required placeholder="E000055821 / 10001 / C-5001" autocomplete="off">
<div class="form-text"><?= Util::h(I18n::t('lookup_passport_hint')) ?></div>
</div>
<button class="btn btn-success" type="submit"><?= Util::h(I18n::t('lookup_submit')) ?></button>
</form>
<p class="small text-muted"><?= Util::h(I18n::t('lookup_qr_hint')) ?></p>
<?php require __DIR__ . '/partials/footer.php'; ?>