public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Adolf Belka <adolf.belka@ipfire.org>
To: development@lists.ipfire.org
Cc: Adolf Belka <adolf.belka@ipfire.org>
Subject: [PATCH] fwhosts.cgi: Don't check Country Code when locationgrp initially created
Date: Mon, 17 Nov 2025 18:30:47 +0100	[thread overview]
Message-ID: <20251117173047.184929-2-adolf.belka@ipfire.org> (raw)
In-Reply-To: <20251117173047.184929-1-adolf.belka@ipfire.org>

- When a location group is initially created the Country Code variable is blank. This
   causes an error message that the Country Code is invalid before any country code
   has been selected. This was flagged up by a new forum member.
- This change only checks the Country Code variable for being valid if it is not blank
- If this is not the best way to fix this problem, feel free to modify or replace it.
- Tested as working on my vm testbed.

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 html/cgi-bin/fwhosts.cgi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index 7820523c5..684b18794 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -703,8 +703,10 @@ if ($fwhostsettings{'ACTION'} eq 'savelocationgrp')
 	# Check name
 	if (!&validhostname($grp)){$errormessage.=$Lang::tr{'fwhost err name'};}
 
-	unless (&General::validcc($fwhostsettings{'COUNTRY_CODE'})) {
-		$errormessage = $Lang::tr{'fwhost invalid country code'};
+	if ($fwhostsettings{'COUNTRY_CODE'} ne ''){
+		unless (&General::validcc($fwhostsettings{'COUNTRY_CODE'})) {
+			$errormessage = $Lang::tr{'fwhost invalid country code'};
+		}
 	}
 
 	# Check for existing group name.
-- 
2.51.2



      reply	other threads:[~2025-11-17 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 17:30 [PATCH] core199: Ship general-functions.pl Adolf Belka
2025-11-17 17:30 ` Adolf Belka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251117173047.184929-2-adolf.belka@ipfire.org \
    --to=adolf.belka@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox