feat: Implement user account activation check during login, sending a notification for inactive accounts and preventing access.
This commit is contained in:
parent
5d86a670a4
commit
a30f4c5967
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Pages\Auth;
|
namespace App\Filament\Pages\Auth;
|
||||||
|
|
||||||
|
use App\Enums\IsActive;
|
||||||
use App\Filament\Support\SystemNotification;
|
use App\Filament\Support\SystemNotification;
|
||||||
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
|
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
|
||||||
use DiogoGPinto\AuthUIEnhancer\Pages\Auth\Concerns\HasCustomLayout;
|
use DiogoGPinto\AuthUIEnhancer\Pages\Auth\Concerns\HasCustomLayout;
|
||||||
@ -92,6 +93,17 @@ public function authenticate(): ?LoginResponse
|
|||||||
$this->throwFailureValidationException();
|
$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 (
|
if (
|
||||||
filled($this->userUndertakingMultiFactorAuthentication) &&
|
filled($this->userUndertakingMultiFactorAuthentication) &&
|
||||||
(decrypt($this->userUndertakingMultiFactorAuthentication) === $user->getAuthIdentifier())
|
(decrypt($this->userUndertakingMultiFactorAuthentication) === $user->getAuthIdentifier())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user