feat(auth): block admin login IP after 4 failures for 20 min, email login alerts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-22 22:35:35 +07:00
co-authored by Claude Opus 5.5
parent fe68171aa7
commit e34362b9bd
16 changed files with 403 additions and 27 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class AdminLoginBlock extends Model
{
protected $guarded = [];
protected $casts = [
'last_failed_at' => 'datetime',
'blocked_until' => 'datetime',
];
public function isBlocked(): bool
{
return $this->blocked_until !== null && $this->blocked_until->isFuture();
}
public function scopeActive(Builder $query): Builder
{
return $query->where('blocked_until', '>', now());
}
}