From 62ad0304babd1e87a7433a928676fcee1607b433 Mon Sep 17 00:00:00 2001 From: Harald Leithner Date: Tue, 22 Dec 2020 20:41:23 +0100 Subject: [PATCH] Do not send the smtppass on test if field is disabled (#31724) --- media/system/js/sendtestmail-uncompressed.js | 7 ++++++- media/system/js/sendtestmail.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/media/system/js/sendtestmail-uncompressed.js b/media/system/js/sendtestmail-uncompressed.js index 32b33839d4e25..02547910d7dbd 100644 --- a/media/system/js/sendtestmail-uncompressed.js +++ b/media/system/js/sendtestmail-uncompressed.js @@ -14,7 +14,6 @@ var sendTestMail = function () var email_data = { smtpauth : $('input[name="jform[smtpauth]"]:checked').val(), smtpuser : $('input[name="jform[smtpuser]"]').val(), - smtppass : $('input[name="jform[smtppass]"]').val(), smtphost : $('input[name="jform[smtphost]"]').val(), smtpsecure: $('select[name="jform[smtpsecure]"]').val(), smtpport : $('input[name="jform[smtpport]"]').val(), @@ -24,6 +23,12 @@ var sendTestMail = function () mailonline: $('input[name="jform[mailonline]"]:checked').val() }; + var $smtppass = $('input[name="jform[smtppass]"]'); + + if ($smtppass.is(':disabled') === false) { + email_data.smtppass = $smtppass.val(); + } + // Remove js messages, if they exist. Joomla.removeMessages(); diff --git a/media/system/js/sendtestmail.js b/media/system/js/sendtestmail.js index ab0314a2072d1..6c5895781c6ed 100644 --- a/media/system/js/sendtestmail.js +++ b/media/system/js/sendtestmail.js @@ -1 +1 @@ -var sendTestMail=function(){$=jQuery;var e={smtpauth:$('input[name="jform[smtpauth]"]:checked').val(),smtpuser:$('input[name="jform[smtpuser]"]').val(),smtppass:$('input[name="jform[smtppass]"]').val(),smtphost:$('input[name="jform[smtphost]"]').val(),smtpsecure:$('select[name="jform[smtpsecure]"]').val(),smtpport:$('input[name="jform[smtpport]"]').val(),mailfrom:$('input[name="jform[mailfrom]"]').val(),fromname:$('input[name="jform[fromname]"]').val(),mailer:$('select[name="jform[mailer]"]').val(),mailonline:$('input[name="jform[mailonline]"]:checked').val()};Joomla.removeMessages(),$.ajax({method:"POST",url:document.getElementById("sendtestmail").getAttribute("data-ajaxuri"),data:e,dataType:"json"}).fail(function(e,a,m){Joomla.renderMessages(Joomla.ajaxErrorsMessages(e,a,m)),window.scrollTo(0,0)}).done(function(e){"object"==typeof e.messages&&null!==e.messages&&(Joomla.renderMessages(e.messages),window.scrollTo(0,0))})};jQuery(document).ready(function(e){e("#sendtestmail").click(sendTestMail)}); \ No newline at end of file +var sendTestMail=function(){$=jQuery;var e={smtpauth:$('input[name="jform[smtpauth]"]:checked').val(),smtpuser:$('input[name="jform[smtpuser]"]').val(),smtphost:$('input[name="jform[smtphost]"]').val(),smtpsecure:$('select[name="jform[smtpsecure]"]').val(),smtpport:$('input[name="jform[smtpport]"]').val(),mailfrom:$('input[name="jform[mailfrom]"]').val(),fromname:$('input[name="jform[fromname]"]').val(),mailer:$('select[name="jform[mailer]"]').val(),mailonline:$('input[name="jform[mailonline]"]:checked').val()},a=$('input[name="jform[smtppass]"]');!1===a.is(":disabled")&&(e.smtppass=a.val()),Joomla.removeMessages(),$.ajax({method:"POST",url:document.getElementById("sendtestmail").getAttribute("data-ajaxuri"),data:e,dataType:"json"}).fail(function(e,a,s){Joomla.renderMessages(Joomla.ajaxErrorsMessages(e,a,s)),window.scrollTo(0,0)}).done(function(e){"object"==typeof e.messages&&null!==e.messages&&(Joomla.renderMessages(e.messages),window.scrollTo(0,0))})};jQuery(document).ready(function(e){e("#sendtestmail").click(sendTestMail)});