fix: Resolve password_hash default value error and disable OTP autofill

This commit is contained in:
Hamza-Ayed
2026-08-26 23:24:35 +03:00
parent 0d63554a1f
commit 6201630865
4 changed files with 12 additions and 18 deletions
+3 -9
View File
@@ -129,10 +129,6 @@ class AuthController
]
];
if ($isDebug) {
$resData['debug_otp'] = $otp;
}
$response->json($resData);
}
@@ -181,9 +177,6 @@ class AuthController
if ($storedHash && password_verify($inputOtp, $storedHash)) {
$isValidOtp = true;
$redis->del($otpKey); // Invalidate OTP after success
} elseif (getenv('APP_DEBUG') && $inputOtp === '123456') {
// Master debug OTP
$isValidOtp = true;
}
if (!$isValidOtp) {
@@ -209,10 +202,11 @@ class AuthController
$encryptedPhone = Security::encrypt($cleanPhone);
$encryptedName = Security::encrypt($fullName ?: ($role === 'teacher' ? 'معلم جديد' : 'طالب جديد'));
$randomPassword = password_hash(bin2hex(random_bytes(16)), PASSWORD_BCRYPT);
$userId = Database::insert(
"INSERT INTO users (uuid, full_name, phone_number, phone_hash, role, status, token_version) VALUES (?, ?, ?, ?, ?, 'active', 1)",
[$uuid, $encryptedName, $encryptedPhone, $phoneHash, $role]
"INSERT INTO users (uuid, full_name, phone_number, phone_hash, password_hash, role, status, token_version) VALUES (?, ?, ?, ?, ?, ?, 'active', 1)",
[$uuid, $encryptedName, $encryptedPhone, $phoneHash, $randomPassword, $role]
);
$user = [