Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions website3.0/pages/OTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,10 +22,10 @@ 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))]);
setOtp([...(otp ?? []).map((d, idx) => (idx === index ? element.value : d))]);

// Move focus to the next input field if value is entered
if (element.value !== '') {
Expand Down
Loading