Revert "Perbaikan API WA" dan "Perbaikan Generate Token Baru"
Mengembalikan fitur verifikasi presensi via WhatsApp ke kondisi semula sebelum perubahan mekanisme regenerasi token sesi. This reverts commit1d58c66a7a. This reverts commitdcf57bcfdc. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,36 +76,6 @@ class VerifikasiAbsenLinkService
|
||||
return ['ok' => true, 'nip' => $row->nip, 'reason' => null];
|
||||
}
|
||||
|
||||
/**
|
||||
* Terbitkan token baru untuk pengajuan yang sesinya sudah habis, dipicu lewat aksi eksplisit
|
||||
* (tombol "Minta Token Baru" di halaman error), bukan otomatis saat tautan dibuka ulang.
|
||||
* Token lama tetap harus dikenali (belum invalid) dan link belum lewat masa berlaku (5 hari).
|
||||
*/
|
||||
public function regenerate(int $pengajuanId, ?string $token): ?string
|
||||
{
|
||||
if (! $token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$row = VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
|
||||
->where('token', $this->hash($token))
|
||||
->where('purpose', self::PURPOSE)
|
||||
->first();
|
||||
|
||||
if (! $row || now()->greaterThan($row->expires_at)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$tokenBaru = Str::random(40);
|
||||
|
||||
$row->update([
|
||||
'token' => $this->hash($tokenBaru),
|
||||
'first_accessed_at' => null,
|
||||
]);
|
||||
|
||||
return $tokenBaru;
|
||||
}
|
||||
|
||||
public function markUsed(int $pengajuanId, string $token): void
|
||||
{
|
||||
VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
|
||||
|
||||
Reference in New Issue
Block a user