feat(auth): add optional domain parameter to send OTP code for site personalization
This commit is contained in:
@@ -142,6 +142,7 @@ class AuthController extends BaseController
|
||||
|
||||
$data = json_decode($request->getContent(), true) ?? [];
|
||||
$mobile = trim($data['mobile'] ?? '');
|
||||
$domain = isset($data['domain']) ? substr(trim((string) $data['domain']), 0, 253) : null;
|
||||
|
||||
if (!preg_match('/^09[0-9]{9}$/', $mobile)) {
|
||||
return $this->error(ErrorCodes::ERR_VALIDATION_001, 'فرمت شماره موبایل نادرست است', 422, 'mobile');
|
||||
@@ -154,7 +155,7 @@ class AuthController extends BaseController
|
||||
return $this->error(ErrorCodes::ERR_RATE_LIMIT_001, ErrorCodes::message(ErrorCodes::ERR_RATE_LIMIT_001), 429);
|
||||
}
|
||||
|
||||
$uuid = $this->otpService->sendCode($mobile);
|
||||
$uuid = $this->otpService->sendCode($mobile, $domain ?: null);
|
||||
|
||||
return new JsonResponse(['uuid' => $uuid, 'message' => 'کد تایید با موفقیت ارسال شد.']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user