feat: Implement user account activation check during login, sending a notification for inactive accounts and preventing access.

This commit is contained in:
Yoga Pangestu 2026-03-29 21:02:27 +07:00
parent 5d86a670a4
commit a30f4c5967

View File

@ -2,6 +2,7 @@
namespace App\Filament\Pages\Auth;
use App\Enums\IsActive;
use App\Filament\Support\SystemNotification;
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
use DiogoGPinto\AuthUIEnhancer\Pages\Auth\Concerns\HasCustomLayout;
@ -92,6 +93,17 @@ public function authenticate(): ?LoginResponse
$this->throwFailureValidationException();
}
if ($user->is_active === IsActive::Inactive) {
SystemNotification::danger(
'Akses Ditangguhkan ⛔',
'Maaf, Anda tidak dapat masuk karena status akun saat ini sedang tidak aktif. Silakan hubungi Administrator untuk informasi lebih lanjut. 😴'
)->send();
throw ValidationException::withMessages([
'login' => 'Akun Anda sedang dinonaktifkan.',
]);
}
if (
filled($this->userUndertakingMultiFactorAuthentication) &&
(decrypt($this->userUndertakingMultiFactorAuthentication) === $user->getAuthIdentifier())