feat(auth): add optional domain parameter to send OTP code for site personalization

This commit is contained in:
hamed
2026-07-04 11:01:54 +03:30
parent 8df7b2f2e0
commit 1bb9cedd22
6 changed files with 177 additions and 6 deletions
+2 -1
View File
@@ -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' => 'کد تایید با موفقیت ارسال شد.']);
}