|
@@ -52,6 +52,8 @@
|
|
|
const wizardSection = document.getElementById('wizardSection');
|
|
const wizardSection = document.getElementById('wizardSection');
|
|
|
const applicationForm = document.getElementById('applicationForm');
|
|
const applicationForm = document.getElementById('applicationForm');
|
|
|
const applicationEmail = document.getElementById('applicationEmail');
|
|
const applicationEmail = document.getElementById('applicationEmail');
|
|
|
|
|
+ const applicationWebsiteInput = document.getElementById('applicationWebsite');
|
|
|
|
|
+ const startWebsiteInput = document.getElementById('website');
|
|
|
const progress = document.getElementById('progress');
|
|
const progress = document.getElementById('progress');
|
|
|
const prevBtn = document.getElementById('prevBtn');
|
|
const prevBtn = document.getElementById('prevBtn');
|
|
|
const nextBtn = document.getElementById('nextBtn');
|
|
const nextBtn = document.getElementById('nextBtn');
|
|
@@ -194,6 +196,15 @@
|
|
|
return String(code || '').replace(/[^\d]/g, '').slice(0, 6);
|
|
return String(code || '').replace(/[^\d]/g, '').slice(0, 6);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function honeypotValue() {
|
|
|
|
|
+ const applicationValue = applicationWebsiteInput ? String(applicationWebsiteInput.value || '').trim() : '';
|
|
|
|
|
+ if (applicationValue !== '') {
|
|
|
|
|
+ return applicationValue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return startWebsiteInput ? String(startWebsiteInput.value || '').trim() : '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function isValidEmail(email) {
|
|
function isValidEmail(email) {
|
|
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
|
}
|
|
}
|
|
@@ -1227,7 +1238,7 @@
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
fd.append('email', state.email);
|
|
fd.append('email', state.email);
|
|
|
- fd.append('website', '');
|
|
|
|
|
|
|
+ fd.append('website', honeypotValue());
|
|
|
fd.append('field', fieldKey);
|
|
fd.append('field', fieldKey);
|
|
|
fd.append('index', String(index));
|
|
fd.append('index', String(index));
|
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
@@ -1477,7 +1488,7 @@
|
|
|
async function requestOtpCode(email, autoStart) {
|
|
async function requestOtpCode(email, autoStart) {
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
- fd.append('website', '');
|
|
|
|
|
|
|
+ fd.append('website', honeypotValue());
|
|
|
fd.append('email', email);
|
|
fd.append('email', email);
|
|
|
fd.append('auto_start', autoStart ? '1' : '0');
|
|
fd.append('auto_start', autoStart ? '1' : '0');
|
|
|
return postForm(appUrl('api/request-otp.php'), fd);
|
|
return postForm(appUrl('api/request-otp.php'), fd);
|
|
@@ -1486,7 +1497,7 @@
|
|
|
async function verifyOtpCode(email, code) {
|
|
async function verifyOtpCode(email, code) {
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
- fd.append('website', '');
|
|
|
|
|
|
|
+ fd.append('website', honeypotValue());
|
|
|
fd.append('email', email);
|
|
fd.append('email', email);
|
|
|
fd.append('otp_code', code);
|
|
fd.append('otp_code', code);
|
|
|
return postForm(appUrl('api/verify-otp.php'), fd);
|
|
return postForm(appUrl('api/verify-otp.php'), fd);
|
|
@@ -1497,7 +1508,7 @@
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
fd.append('email', state.email);
|
|
fd.append('email', state.email);
|
|
|
fd.append('step', String(Math.min(state.currentStep, state.totalSteps)));
|
|
fd.append('step', String(Math.min(state.currentStep, state.totalSteps)));
|
|
|
- fd.append('website', '');
|
|
|
|
|
|
|
+ fd.append('website', honeypotValue());
|
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
|
|
|
|
|
|
Array.from(applicationForm.elements).forEach((el) => {
|
|
Array.from(applicationForm.elements).forEach((el) => {
|
|
@@ -1536,7 +1547,7 @@
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
fd.append('email', email);
|
|
fd.append('email', email);
|
|
|
- fd.append('website', '');
|
|
|
|
|
|
|
+ fd.append('website', honeypotValue());
|
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
|
return postForm(appUrl('api/load-draft.php'), fd);
|
|
return postForm(appUrl('api/load-draft.php'), fd);
|
|
|
}
|
|
}
|
|
@@ -1545,7 +1556,7 @@
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
fd.append('email', email);
|
|
fd.append('email', email);
|
|
|
- fd.append('website', '');
|
|
|
|
|
|
|
+ fd.append('website', honeypotValue());
|
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
fd.append('last_user_activity_at', String(state.lastUserActivityAt));
|
|
|
return postForm(appUrl('api/reset.php'), fd);
|
|
return postForm(appUrl('api/reset.php'), fd);
|
|
|
}
|
|
}
|