sub CheckEmailSyntax {
my ($addr) = (@_);
- if ($addr !~ /^[^@, ]*@[^@, ]*\.[^@, ]*$/) {
+ my $match = Param('emailregexp');
+ if ($addr !~ /$match/) {
print "Content-type: text/html\n\n";
print "<H1>Invalid e-mail address entered.</H1>\n";
print "The e-mail address you entered\n";
print "(<b>$addr</b>) didn't match our minimal\n";
- print "syntax checking for a legal email address. A legal\n";
- print "address must contain exactly one '\@', and at least one\n";
- print "'.' after the \@, and may not contain any commas or.\n";
- print "spaces.\n";
+ print "syntax checking for a legal email address.\n";
+ print Param('emailregexpdesc');
print "<p>Please click <b>back</b> and try again.\n";
exit;
}
(Your bugzilla and CVS password, if any, are not currently synchronized.
Top hackers are working around the clock to fix this, as you read this.)
";
- my $msg = sprintf($template, $login, $login, $password);
+ my $msg = sprintf($template, $login . Param('emailsuffix'),
+ $login, $password);
open SENDMAIL, "|/usr/lib/sendmail -t";
print SENDMAIL $msg;
"b",
0);
+DefParam("emailregexp",
+ 'This defines the regexp to use for legal email addresses. The default tries to match fully qualified email addresses. Another popular value to put here is <tt>^[^@, ]$</tt>, which means "local usernames, no @ allowed.',
+ "t",
+ q:^[^@, ]*@[^@, ]*\\.[^@, ]*$:);
+
+DefParam("emailregexpdesc",
+ "This describes in english words what kinds of legal addresses are allowed by the <tt>emailregexp</tt> param.",
+ "l",
+ "A legal address must contain exactly one '\@', and at least one '.' after the \@, and may not contain any commas or spaces.");
+
+DefParam("emailsuffix",
+ "This is a string to append to any email addresses when actually sending mail to that address. It is useful if you have changed the <tt>emailregexp</tt> param to only allow local usernames, but you want the mail to be delivered to username\@my.local.hostname.",
+ "t",
+ "");
+
+
1;