Fix #19: Plaintext OTP hashing + hardcoded server paths
- Changed OTP storage in Admin/auth/login.php from plaintext to sha256 hash - Updated Admin/auth/verify_login.php to hash user input before comparison - Replaced hardcoded /home/siro-api/ paths with environment variables: - ERROR_LOG_PATH, ENV_FILE_PATH, SECRET_KEY_PAY_PATH, SECRET_KEY_PATH - Falls back to __DIR__-relative paths when env vars are unset
This commit is contained in:
@@ -20,10 +20,7 @@ if ($debugMode) {
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
// تحديد مسار اللوج بشكل ديناميكي (محلياً أو سيرفر)
|
||||
$logPath = '/home/siro-api/logs/php_errors.log';
|
||||
if (!file_exists(dirname($logPath)) || !is_writable(dirname($logPath))) {
|
||||
$logPath = __DIR__ . '/../logs/php_errors.log';
|
||||
}
|
||||
$logPath = getenv('ERROR_LOG_PATH') ?: (__DIR__ . '/../logs/php_errors.log');
|
||||
ini_set('error_log', $logPath);
|
||||
|
||||
header_remove('X-Powered-By');
|
||||
@@ -54,10 +51,7 @@ if ($vendorPath) require_once $vendorPath;
|
||||
require_once __DIR__ . '/helpers.php';
|
||||
|
||||
// تحديد مسار الـ .env بشكل ديناميكي
|
||||
$envFile = '/home/siro-api/env/.env';
|
||||
if (!file_exists($envFile)) {
|
||||
$envFile = __DIR__ . '/../.env'; // مسار محلي افتراضي
|
||||
}
|
||||
$envFile = getenv('ENV_FILE_PATH') ?: (__DIR__ . '/../.env');
|
||||
loadEnvironment($envFile);
|
||||
|
||||
// 4. Redis Connection (Singleton)
|
||||
|
||||
Reference in New Issue
Block a user