Update: 2026-06-12 20:40:40

This commit is contained in:
Hamza-Ayed
2026-06-12 20:40:40 +03:00
parent 305ae01d52
commit f907212c57
294 changed files with 3592 additions and 3581 deletions

0
backend/serviceapp/addCartoDriver.php Executable file → Normal file
View File

View File

0
backend/serviceapp/editCarPlate.php Executable file → Normal file
View File

0
backend/serviceapp/getCarPlateNotEdit.php Executable file → Normal file
View File

0
backend/serviceapp/getDriverByNational.php Executable file → Normal file
View File

0
backend/serviceapp/getDriverDetailsForActivate.php Executable file → Normal file
View File

View File

0
backend/serviceapp/getDriversPhoneNotComplete.php Executable file → Normal file
View File

0
backend/serviceapp/getDriversWaitingActive.php Executable file → Normal file
View File

0
backend/serviceapp/getEditorStatsCalls.php Executable file → Normal file
View File

View File

0
backend/serviceapp/getEmployeeStatic.php Executable file → Normal file
View File

0
backend/serviceapp/getJsonFile.php Executable file → Normal file
View File

0
backend/serviceapp/getNotesForEmployee.php Executable file → Normal file
View File

0
backend/serviceapp/getPackages.php Executable file → Normal file
View File

0
backend/serviceapp/getRidesStatic.php Executable file → Normal file
View File

0
backend/serviceapp/getdriverWithoutCar.php Executable file → Normal file
View File

29
backend/serviceapp/login.php Executable file → Normal file
View File

@@ -3,6 +3,7 @@ require_once __DIR__ . '/../core/bootstrap.php';
$fingerprint = filterRequest('fingerprint');
$password = filterRequest('password');
$email = filterRequest('email');
$audience = filterRequest('aud') ?? 'service';
if (empty($fingerprint) || empty($password)) {
@@ -10,6 +11,10 @@ if (empty($fingerprint) || empty($password)) {
exit();
}
// Rate Limiting: 5 محاولات في الدقيقة لكل IP
$rateLimiter = new RateLimiter($redis);
$rateLimiter->enforce(RateLimiter::identifier(), 'login');
try {
$con = Database::get('main');
@@ -20,6 +25,28 @@ try {
$stmt->execute([':fp' => $fpHash]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
// إذا لم يتم العثور بالبصمة، وتم تمرير الإيميل (تسجيل دخول لأول مرة أو من جهاز جديد)
if (!$user && !empty($email)) {
$encEmailInput = $encryptionHelper->encryptData($email);
$stmtEmail = $con->prepare("SELECT * FROM `users` WHERE `email` = :email AND `user_type` = 'service' LIMIT 1");
$stmtEmail->execute([':email' => $encEmailInput]);
$user = $stmtEmail->fetch(PDO::FETCH_ASSOC);
// تأكيد كلمة المرور وتحديث بصمة الجهاز إذا تم إيجاد الحساب
if ($user && password_verify($password, $user['password'])) {
$encFpRaw = $encryptionHelper->encryptData($fingerprint);
$updateStmt = $con->prepare("UPDATE `users` SET fingerprint = :fp_raw, fingerprint_hash = :fp WHERE id = :id");
$updateStmt->execute([
':fp_raw' => $encFpRaw,
':fp' => $fpHash,
':id' => $user['id']
]);
$user['fingerprint_hash'] = $fpHash; // Update locally
} else if ($user) {
// Password incorrect, fail later.
}
}
if ($user) {
// التحقق من حالة الحساب
if ($user['status'] === 'pending') {
@@ -94,7 +121,7 @@ try {
jsonError("Incorrect password");
}
} else {
jsonError("الجهاز غير مسجل لموظف خدمة.");
jsonError("الجهاز أو الحساب غير مسجل. يرجى إدخال البريد الإلكتروني وكلمة المرور إذا كان هذا أول تسجيل دخول لك.");
}
} catch (Exception $e) {
error_log("[ServiceApp Login Error] " . $e->getMessage());

View File

@@ -18,6 +18,19 @@ if (empty($firstName) || empty($lastName) || empty($email) || empty($phone) || e
}
try {
// 1. التحقق من البيئة (Environment Whitelist)
$allowedPhonesStr = getenv('AUTHORIZED_SERVICE_PHONES');
if (!$allowedPhonesStr) {
jsonError("غير مصرح لك بالتسجيل كموظف خدمة (القائمة البيضاء غير معدة).");
exit;
}
$allowedPhones = array_map('trim', explode(',', $allowedPhonesStr));
if (!in_array($phone, $allowedPhones)) {
jsonError("أنت غير مصرح لك بالتسجيل كموظف خدمة. يرجى مراجعة الإدارة.");
exit;
}
$con = Database::get('main');
// 1. التحقق من عدم وجود الحساب مسبقاً (عن طريق البريد الإلكتروني، الهاتف أو البصمة)

0
backend/serviceapp/registerDriverAndCarService.php Executable file → Normal file
View File

0
backend/serviceapp/updateDriver.php Executable file → Normal file
View File

0
backend/serviceapp/updateDriverToActive.php Executable file → Normal file
View File

0
backend/serviceapp/updatePackages.php Executable file → Normal file
View File

0
backend/serviceapp/web/drivers.html Executable file → Normal file
View File

0
backend/serviceapp/web/f.html Executable file → Normal file
View File

0
backend/serviceapp/web/getDrivers.php Executable file → Normal file
View File

0
backend/serviceapp/work/addCarWantWork.php Executable file → Normal file
View File

0
backend/serviceapp/work/addDriverWantWork.php Executable file → Normal file
View File