Auto Past Vfs
Auto Past Vfs
(function() {
'use strict';
// Function to retrieve OTP from clipboard and paste it into the designated
input field
function pasteOTPFromClipboardAndSubmit() {
if (stopFunction || submitted) return; // Stop execution if flag is set or
submission has occurred
navigator.clipboard.readText().then(clipboardText => {
const otpInput = document.querySelector('input#OTPe');
if (otpInput && clipboardText.trim() !== '') {
const otpRegex = /^\d{6}$/; // Regex to match exactly 6 digits
if (otpRegex.test(clipboardText.trim())) {
otpInput.value = clipboardText.trim(); // Paste OTP from clipboard
console.log('OTP pasted from clipboard:', clipboardText.trim());
clearClipboard(); // Clear the clipboard after OTP is pasted
clickSubmitButton(); // Click the submit button after OTP is pasted
} else {
console.log('Invalid OTP format. OTP must contain exactly 6
digits.');
}
} else {
console.log('No OTP input field found or clipboard is empty.');
}
}).catch(error => {
console.error('Failed to read clipboard:', error);
});
}