]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
fwhosts.cgi: Don't check Country Code when locationgrp initially created
authorAdolf Belka <adolf.belka@ipfire.org>
Mon, 17 Nov 2025 17:30:47 +0000 (18:30 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Nov 2025 15:15:44 +0000 (15:15 +0000)
- 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>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/fwhosts.cgi

index 7820523c5e6e8892263d750e13f77f54c3e8b7a8..684b187942ae876ae38c7e1ac2a6bd63ea54a24f 100644 (file)
@@ -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.