Update: 2026-05-03 21:58:11
This commit is contained in:
@@ -28,10 +28,11 @@ if ($errors) {
|
||||
$email = $data['email'];
|
||||
$password = $data['password'];
|
||||
|
||||
// 2. DB Check
|
||||
// 2. DB Check (Using hash for lookup since email is encrypted)
|
||||
$db = Database::getInstance();
|
||||
$stmt = $db->prepare("SELECT * FROM users WHERE email = ? LIMIT 1");
|
||||
$stmt->execute([$email]);
|
||||
$emailHash = hash('sha256', strtolower($email));
|
||||
$stmt = $db->prepare("SELECT * FROM users WHERE email_hash = ? LIMIT 1");
|
||||
$stmt->execute([$emailHash]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
if (!$user || !password_verify($password, $user['password_hash'])) {
|
||||
@@ -63,7 +64,7 @@ json_success([
|
||||
'refresh_token' => $refreshToken,
|
||||
'user' => [
|
||||
'id' => $user['id'],
|
||||
'name' => $user['name'],
|
||||
'email' => $user['email']
|
||||
'name' => (App\Core\Encryption::decrypt($user['name']) ?: $user['name']),
|
||||
'email' => (App\Core\Encryption::decrypt($user['email']) ?: $user['email'])
|
||||
]
|
||||
], 'تم تسجيل الدخول بنجاح');
|
||||
|
||||
Reference in New Issue
Block a user