From a6b159e90ac0baf841eba07381fed54e3489cfdd Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 28 Mar 2024 16:16:30 +0100 Subject: tighten validation --- kontakt.cgi | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/kontakt.cgi b/kontakt.cgi index 99951e3..694aabe 100755 --- a/kontakt.cgi +++ b/kontakt.cgi @@ -19,11 +19,6 @@ my $helpdesk = 'siri@jones.dk'; # Set this to 1 for a separate confirmation page my ($confirm) = 1; -# Built-in email validation is too simplistic -my $valid_email = '/^[+_A-Za-z0-9-]+(\.[+_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[_A-Za-z0-9-]+)$/'; - -my $valid_zip_dk = '/^([Dd][Kk])?.?[0-9-]{4}$/'; - my $form = CGI::FormBuilder->new( lang => 'da', title => 'Henvendelse til Byvandring.nu', @@ -39,10 +34,9 @@ my $form = CGI::FormBuilder->new( kommentar /], validate => { - postnr => $valid_zip_dk, - _postnr => $valid_zip_dk, #fake check to silence warning of variable used only once - email => $valid_email, - _email => $valid_email, #fake check to silence warning of variable used only once + postnr => '/^([Dd][Kk])?.?[0-9-]{4}$/', + #email => 'MAIL', # Built-in email validation is too simplistic + email => '/^[+_A-Za-z0-9-]+(\.[+_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[_A-Za-z0-9-]+)$/', antal => 'INT', }, required => [qw/ -- cgit v1.2.3