Update: 2026-06-25 18:53:08
This commit is contained in:
@@ -19,7 +19,7 @@ if (empty($fingerprint) || empty($password)) {
|
||||
|
||||
// Rate Limiting محسَّن مع Exponential Backoff
|
||||
$rateLimiter = new RateLimiter($redis);
|
||||
$rateLimiter->enforce(RateLimiter::identifier(), 'login', maxAttempts: 5, windowSeconds: 60);
|
||||
$rateLimiter->enforce(RateLimiter::identifier(), 'login');
|
||||
|
||||
// تتبع المحاولات الفاشلة لكل حساب لمنع credential stuffing عبر IPs متعددة
|
||||
if ($redis && !empty($phone)) {
|
||||
@@ -34,10 +34,13 @@ if ($redis && !empty($phone)) {
|
||||
}
|
||||
}
|
||||
|
||||
// البحث عن المشرف باستخدام بصمة الجهاز (Fingerprint Hash)
|
||||
$fpHash = hash('sha256', $fingerprint);
|
||||
|
||||
// تسجيل محاولة تسجيل الدخول للتدقيق
|
||||
$loginAuditData = [
|
||||
'ip' => $_SERVER['REMOTE_ADDR'] ?? 'unknown',
|
||||
'fingerprint_hash' => $fpHash ?? null,
|
||||
'fingerprint_hash' => $fpHash,
|
||||
'phone_hash' => !empty($phone) ? hash('sha256', $phone) : null,
|
||||
'timestamp' => date('Y-m-d H:i:s'),
|
||||
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'unknown',
|
||||
@@ -47,9 +50,6 @@ error_log("[LOGIN_AUDIT] " . json_encode($loginAuditData));
|
||||
|
||||
try {
|
||||
$con = Database::get('main');
|
||||
|
||||
// البحث عن المشرف باستخدام بصمة الجهاز (Fingerprint Hash)
|
||||
$fpHash = hash('sha256', $fingerprint);
|
||||
$stmt = $con->prepare("SELECT * FROM adminUser WHERE fingerprint_hash = :fp LIMIT 1");
|
||||
$stmt->execute([':fp' => $fpHash]);
|
||||
$admin = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
@@ -50,7 +50,9 @@ class _AdminLoginPageState extends State<AdminLoginPage>
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
final otpHelper = Get.find<OtpHelper>();
|
||||
final otpHelper = Get.isRegistered<OtpHelper>()
|
||||
? Get.find<OtpHelper>()
|
||||
: Get.put(OtpHelper(), permanent: true);
|
||||
bool success = await otpHelper.loginWithPassword(password, phone);
|
||||
|
||||
if (success) {
|
||||
|
||||
Reference in New Issue
Block a user