From mboxrd@z Thu Jan  1 00:00:00 1970
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 1/2] mail.cgi: Always check content of fields
Date: Wed, 30 Oct 2019 10:58:59 +0000
Message-ID: <20191030105900.15306-1-michael.tremer@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============7362105217597506113=="
List-Id: <development.lists.ipfire.org>

--===============7362105217597506113==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

These checks did not do anything but clear all fields
when mailing was disabled.

It makes a lot more sense to retain people's settings,
even when they have been disabled.

Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
 html/cgi-bin/mail.cgi | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/html/cgi-bin/mail.cgi b/html/cgi-bin/mail.cgi
index 9cf14cac8..07986a4d6 100755
--- a/html/cgi-bin/mail.cgi
+++ b/html/cgi-bin/mail.cgi
@@ -81,19 +81,10 @@ if ( -f $mailfile){
 
 #ACTIONS
 if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){ #SaveButton on configsite
-	#Check fields
-	if ($cgiparams{'USEMAIL'} eq 'on'){
-		$errormessage=&checkmailsettings;
-	}else{
-		$cgiparams{'txt_mailserver'}='';
-		$cgiparams{'txt_mailport'}='';
-		$cgiparams{'txt_mailuser'}='';
-		$cgiparams{'txt_mailpass'}='';
-		$cgiparams{'mail_tls'}='';
-		$cgiparams{'txt_mailsender'}='';
-		$cgiparams{'txt_recipient'}='';
-	}
-	if(!$errormessage){
+	# Check fields
+	$errormessage = &checkmailsettings();
+
+	if (!$errormessage) {
 		#clear hashes
 		%auth=();
 		%dma=();
-- 
2.20.1


--===============7362105217597506113==--