Improve live DB clone speed
This commit is contained in:
@@ -404,7 +404,11 @@ class authRoute
|
||||
'pageSize' => 1, // Since the limit is 1000, we need to set the page size to 1000.
|
||||
])->collection);
|
||||
// Check if the customer number is already in use in our system
|
||||
if ((new users_o())->getUserByCustomerNumber((int)$companyPhone)->exists()) {
|
||||
$existingCompanyUser = (new users_o())->getUserByCustomerNumber((int)$companyPhone);
|
||||
$companyPhoneAlreadyRegistered = method_exists($existingCompanyUser, 'exists')
|
||||
? (bool)$existingCompanyUser->exists()
|
||||
: ((int)($existingCompanyUser->id ?? 0) > 0);
|
||||
if ($companyPhoneAlreadyRegistered) {
|
||||
$response->error('Company phone number already registered', 400);
|
||||
}
|
||||
if (count($economic_response) === 0) {
|
||||
@@ -584,7 +588,10 @@ class authRoute
|
||||
$challenge = rtrim(strtr(base64_encode($rawChallenge), '+/', '-_'), '=');
|
||||
|
||||
// rpId for passkeys
|
||||
$rpId = parse_url((string)$_SERVER['HTTP_ORIGIN'], PHP_URL_HOST) ?: $_SERVER['SERVER_NAME'];
|
||||
$originHost = parse_url((string)($_SERVER['HTTP_ORIGIN'] ?? ''), PHP_URL_HOST);
|
||||
$httpHost = isset($_SERVER['HTTP_HOST']) ? explode(':', (string)$_SERVER['HTTP_HOST'])[0] : null;
|
||||
$serverName = $_SERVER['SERVER_NAME'] ?? null;
|
||||
$rpId = $originHost ?: $httpHost ?: $serverName ?: 'truckwash.io';
|
||||
|
||||
// Create an ephemeral token to bind the challenge to the (potential) user
|
||||
(new tokens_o())->create($user_id, $challenge_token, 'PASSKEY_CHALLENGE');
|
||||
@@ -691,4 +698,4 @@ class authRoute
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user