Fixed va register bugs

This commit is contained in:
Aakash Mittal 2025-11-24 18:09:49 +05:30
parent 68d81f8e1c
commit 8bff39fb4c
3 changed files with 78 additions and 26 deletions

View File

@ -822,18 +822,37 @@
const payoneerError = document.getElementById('payoneer-error'); const payoneerError = document.getElementById('payoneer-error');
const value = input.value.trim(); const value = input.value.trim();
// Payoneer typically uses email format or alphanumeric IDs // Remove any validation styling first
// Adjust validation rules based on Payoneer's actual format requirements
if (value.length > 0 && (value.length < 5 || value.length > 20)) {
payoneerError.textContent = 'Payoneer account must be 5-20 characters';
payoneerError.style.display = 'block';
input.style.border = '1px solid #ef4445';
return false;
} else {
payoneerError.style.display = 'none';
input.style.border = ''; input.style.border = '';
return true; payoneerError.style.display = 'none';
if (value.length > 0) {
// Check length
if (value.length < 5 || value.length > 20) {
payoneerError.textContent = 'Payoneer account must be 5-20 digits';
payoneerError.style.display = 'block';
input.style.border = '1px solid #ef4444';
return false;
} }
// Check if contains only digits
if (!/^\d+$/.test(value)) {
payoneerError.textContent = 'Payoneer account must contain digits only';
payoneerError.style.display = 'block';
input.style.border = '1px solid #ef4444';
return false;
}
// Check if all zeros
if (/^0+$/.test(value)) {
payoneerError.textContent = 'Payoneer account cannot be all zeros';
payoneerError.style.display = 'block';
input.style.border = '1px solid #ef4444';
return false;
}
}
return true;
} }
// Function to validate Veem account number // Function to validate Veem account number
@ -841,17 +860,37 @@
const veemError = document.getElementById('veem-error'); const veemError = document.getElementById('veem-error');
const value = input.value.trim(); const value = input.value.trim();
// Veem account numbers are typically longer alphanumeric strings // Remove any validation styling first
if (value.length > 0 && (value.length < 8 || value.length > 25)) {
veemError.textContent = 'Veem account must be 8-25 characters';
veemError.style.display = 'block';
input.style.border = '1px solid #ef4445';
return false;
} else {
veemError.style.display = 'none';
input.style.border = ''; input.style.border = '';
return true; veemError.style.display = 'none';
if (value.length > 0) {
// Check length
if (value.length < 8 || value.length > 25) {
veemError.textContent = 'Veem account must be 8-25 digits';
veemError.style.display = 'block';
input.style.border = '1px solid #ef4444';
return false;
} }
// Check if contains only digits
if (!/^\d+$/.test(value)) {
veemError.textContent = 'Veem account must contain digits only';
veemError.style.display = 'block';
input.style.border = '1px solid #ef4444';
return false;
}
// Check if all zeros
if (/^0+$/.test(value)) {
veemError.textContent = 'Veem account cannot be all zeros';
veemError.style.display = 'block';
input.style.border = '1px solid #ef4444';
return false;
}
}
return true;
} }
function showError(message, fieldId = null, step = null) { function showError(message, fieldId = null, step = null) {
@ -924,3 +963,16 @@
option.style.display = ""; option.style.display = "";
} }
} }
function validateSkypeId(input) {
const value = input.value.trim();
if (value && !/^[a-zA-Z][a-zA-Z0-9\.,\-_]+$/.test(value)) {
input.style.border = '1px solid #ef4444';
showError('Skype ID must start with a letter and can only contain letters, numbers, dots, hyphens, and underscores', 'skype', 3);
return false;
} else {
input.style.border = '';
return true;
}
}

View File

@ -77,7 +77,7 @@ app.get('/varegister/:sf_token?', (req, res) => {
const { sf_token } = req.params; const { sf_token } = req.params;
try { try {
// const decoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN); const decoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN);
if (decoded) { if (decoded) {
const email = decoded.email; const email = decoded.email;

View File

@ -307,7 +307,7 @@
<div class="form-group"> <div class="form-group">
<div class="input-container"> <div class="input-container">
<input type="text" id="skype" class="input-field" placeholder=" "> <input type="text" id="skype" class="input-field" placeholder=" " oninput="validateSkypeId(this)">
<label for="skype" class="input-label">Skype ID</label> <label for="skype" class="input-label">Skype ID</label>
</div> </div>
</div> </div>
@ -334,7 +334,7 @@
<div id="payoneer-details" class="payment-details"> <div id="payoneer-details" class="payment-details">
<div class="form-group"> <div class="form-group">
<div class="input-container"> <div class="input-container">
<input type="text" id="payoneerAccount" class="input-field" placeholder=" " minlength="5" maxlength="20" oninput="validatePayoneerAccount(this)" required> <input type="text" id="payoneerAccount" class="input-field" placeholder=" " minlength="5" maxlength="20" oninput="validatePayoneerAccount(this)" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required>
<label for="payoneerAccount" class="input-label">Payoneer Account Number *</label> <label for="payoneerAccount" class="input-label">Payoneer Account Number *</label>
</div> </div>
<div class="invalid-feedback" id="payoneer-error" style="display: none; color: #dc3545; font-size: 12px; margin-top: 5px;"> <div class="invalid-feedback" id="payoneer-error" style="display: none; color: #dc3545; font-size: 12px; margin-top: 5px;">
@ -350,7 +350,7 @@
<div id="veem-details" class="payment-details"> <div id="veem-details" class="payment-details">
<div class="form-group"> <div class="form-group">
<div class="input-container"> <div class="input-container">
<input type="text" id="veemAccount" class="input-field" placeholder=" " minlength="8" maxlength="25" oninput="validateVeemAccount(this)" required> <input type="text" id="veemAccount" class="input-field" placeholder=" " minlength="8" maxlength="25" oninput="validateVeemAccount(this)" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required>
<label for="veemAccount" class="input-label">Veem Account Number *</label> <label for="veemAccount" class="input-label">Veem Account Number *</label>
</div> </div>
<div class="invalid-feedback" id="veem-error" style="display: none; color: #dc3545; font-size: 12px; margin-top: 5px;"> <div class="invalid-feedback" id="veem-error" style="display: none; color: #dc3545; font-size: 12px; margin-top: 5px;">