fix(integrations): prevent blank API integrations (#3840)

* fix(integrations): validate unified API form fields

* fix(integrations): validate API integration fields server-side
This commit is contained in:
Abhishek Kumbhar
2026-06-15 12:10:36 +05:30
committed by GitHub
parent cd41de8043
commit a172522d87
3 changed files with 134 additions and 1 deletions
+5 -1
View File
@@ -3644,7 +3644,11 @@ async function initUnifiedIntegrations() {
el('uf-api-cancel').addEventListener('click', () => { formEl.style.display = 'none'; });
el('uf-api-save').addEventListener('click', async () => {
const presetKey = preset.value || undefined;
const body = { name: name.value, base_url: url.value, auth_type: auth.value, auth_header: header.value, preset: presetKey };
const nameValue = name.value.trim();
const urlValue = url.value.trim();
if (!nameValue) { el('uf-api-msg').textContent = 'Name required'; el('uf-api-msg').style.color = 'var(--red)'; return; }
if (!urlValue) { el('uf-api-msg').textContent = 'Base URL required'; el('uf-api-msg').style.color = 'var(--red)'; return; }
const body = { name: nameValue, base_url: urlValue, auth_type: auth.value, auth_header: header.value, preset: presetKey };
if (key.value) body.api_key = key.value;
try {
const u = _editId ? `/api/auth/integrations/${_editId}` : '/api/auth/integrations';