mirror of
https://github.com/DeNNiiInc/Advanced-Smtp-Tester.git
synced 2026-04-17 17:35:59 +00:00
fix: Add automatic whitespace trimming for form inputs
- Trim all form field values before submission - Prevents copy-paste whitespace issues - Applied to both regular and auto-discovery tests
This commit is contained in:
@@ -270,6 +270,13 @@ document.getElementById('smtpForm').addEventListener('submit', async function (e
|
||||
const formData = new FormData(this);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
// Trim all string values to prevent copy-paste whitespace issues
|
||||
Object.keys(data).forEach(key => {
|
||||
if (typeof data[key] === 'string') {
|
||||
data[key] = data[key].trim();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/test-smtp', {
|
||||
method: 'POST',
|
||||
@@ -365,6 +372,13 @@ document.getElementById('autoTestBtn').addEventListener('click', async function
|
||||
const formData = new FormData(form);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
// Trim all string values
|
||||
Object.keys(data).forEach(key => {
|
||||
if (typeof data[key] === 'string') {
|
||||
data[key] = data[key].trim();
|
||||
}
|
||||
});
|
||||
|
||||
// Only need host, user, pass, from, to for auto test
|
||||
const autoTestData = {
|
||||
host: data.host,
|
||||
|
||||
Reference in New Issue
Block a user