Connect Flutter phone auth and Android platform

This commit is contained in:
Hamza-Ayed
2026-10-04 01:44:07 +03:00
parent 5b90da6b18
commit 98490a17e6
44 changed files with 1271 additions and 168 deletions
+4 -1
View File
@@ -37,6 +37,7 @@ try {
$db = Database::getInstance();
$connection = $db->getConnection();
$connection->begin_transaction();
$transactionOpen = true;
$rateBuckets = [
['phone', hash_hmac('sha256', 'phone:' . $phone, $hashKey), 5, 3600],
@@ -57,6 +58,7 @@ try {
$check->close();
if ($count > $limit) {
$connection->rollback();
$transactionOpen = false;
api_json(['error' => 'rate_limited'], 429);
}
}
@@ -70,11 +72,12 @@ try {
$insert->execute();
$insert->close();
$connection->commit();
$transactionOpen = false;
(new ConfiguredHttpOtpProvider())->send($phone, $code);
api_json(['challenge_id' => $challengeUuid, 'expires_in_seconds' => 300]);
} catch (Throwable $exception) {
if (isset($connection) && $connection instanceof mysqli && $connection->errno === 0) {
if (!empty($transactionOpen) && isset($connection) && $connection instanceof mysqli) {
try { $connection->rollback(); } catch (Throwable $ignored) {}
}
error_log('OTP request failed: ' . $exception->getMessage());