From b8a33eb39a2fb1e994f84dc013440375b9f45dcc Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 21 Jul 2005 04:24:19 +0000 Subject: Bug 301453: Move CheckEmailSyntax out of CGI.pl - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Util.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Util.pm') diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 1ac25d1aa..256be5c31 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -39,7 +39,7 @@ use base qw(Exporter); trim wrap_comment find_wrap_point format_time format_time_decimal file_mod_time - bz_crypt); + bz_crypt check_email_syntax); use Bugzilla::Config; use Bugzilla::Error; @@ -342,6 +342,14 @@ sub bz_crypt ($) { return $cryptedpassword; } +sub check_email_syntax { + my ($addr) = (@_); + my $match = Param('emailregexp'); + if ($addr !~ /$match/ || $addr =~ /[\\\(\)<>&,;:"\[\] \t\r\n]/) { + ThrowUserError("illegal_email_address", { addr => $addr }); + } +} + sub ValidateDate { my ($date, $format) = @_; my $date2; -- cgit v1.2.3-24-g4f1b