diff --git a/website3.0/pages/OTP.js b/website3.0/pages/OTP.js index ec0e94aa..6d3c1683 100644 --- a/website3.0/pages/OTP.js +++ b/website3.0/pages/OTP.js @@ -9,7 +9,7 @@ const OTP = ({ onClose, onOTPSubmit, onBack ,isError,email,theme,setMsg, setIsPo const handlePaste = (e) => { const pasteData = e.clipboardData.getData('text').slice(0, 6); // Get the pasted data and limit it to 6 characters if (pasteData) { - const newOtp = otp.map((char, idx) => pasteData[idx] || ''); + const newOtp = (otp ?? []).map((char, idx) => pasteData[idx] || ''); setOtp(newOtp); // Move focus to the last filled input @@ -22,7 +22,7 @@ const OTP = ({ onClose, onOTPSubmit, onBack ,isError,email,theme,setMsg, setIsPo }; // Handle input change for OTP fields const handleChange = (element, index) => { - if (isNaN(element.value)) return false; + if (Number.isNaN(element.value)) return false; // Update the OTP state setOtp([...otp.map((d, idx) => (idx === index ? element.value : d))]);