diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-03-28 16:16:30 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-03-28 16:16:30 +0100 |
commit | a6b159e90ac0baf841eba07381fed54e3489cfdd (patch) | |
tree | 7e30a0d2095dc1db916ef8a04f8aa54e0476b0f9 /kontakt.cgi | |
parent | 3e0d254e0d6197987f2d8efce144cb29da3c6f7a (diff) |
tighten validation
Diffstat (limited to 'kontakt.cgi')
-rwxr-xr-x | kontakt.cgi | 12 |
1 files 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/ |