Perbaikan Log Verifikasi Absen

This commit is contained in:
Ariyutta
2026-09-30 15:44:52 +07:00
parent 797c9371ce
commit 41d9381170
5 changed files with 47 additions and 10 deletions
@@ -73,6 +73,24 @@ class VerifikasiAbsenLinkService
return ['ok' => true, 'nip' => $row->nip, 'reason' => null];
}
/**
* Cek token hanya sebagai bukti tautan sah (milik pengajuan ini & belum kedaluwarsa), tanpa batas sesi
* dan tanpa memulai sesi. Dipakai untuk melihat file bukti yang tidak mengubah data.
*/
public function tautanSah(int $pengajuanId, ?string $token): bool
{
if (! $token) {
return false;
}
$row = VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
->where('token', $this->hash($token))
->where('purpose', self::PURPOSE)
->first();
return $row !== null && ! now()->greaterThan($row->expires_at);
}
/**
* Sisa detik sesi untuk token ini (0 kalau sudah habis), null kalau token tidak dikenal atau belum pernah dibuka.
*/