fix(otp): support WebOTP sms pattern with {0} and {1} and robust code extraction
Deploy Canina / deploy (push) Successful in 3m53s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 0s

This commit is contained in:
parsa aghaei committed 2026-09-05 19:36:49 +03:30
1 parent 1fd9a92dd0
commit c57f775cb4
15 files changed
+8628 -8534

No files matched your search

@@ -216,9 +216,9 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
signal: ac.signal,
}).then((otp) => {
if (!isMounted || !otp) return;
// OTPCredential.code is the extracted code, not the full SMS text.
// Still run toEnglishDigits in case it contains Persian numerals.
const digits = toEnglishDigits(otp.code ?? "").replace(/[^0-9]/g, "").slice(0, 5);
// OTPCredential.code is the extracted code, but fallback to any string property
const rawCode = (otp as { code?: string })?.code || (otp as { id?: string })?.id || "";
const digits = extractOtpFromText(rawCode);
if (digits.length === 5) {
setOtpCode(digits);
// 400 ms delay so the user can see the filled boxes before verification