fix: Resolve password_hash default value error and disable OTP autofill
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user