[Rt-commit] r18636 - in rt/3.8/trunk: lib/RT

elacour at bestpractical.com elacour at bestpractical.com
Tue Mar 3 10:43:09 EST 2009


Author: elacour
Date: Tue Mar  3 10:43:08 2009
New Revision: 18636

Modified:
   rt/3.8/trunk/etc/RT_Config.pm.in
   rt/3.8/trunk/lib/RT/User_Overlay.pm

Log:
Make syntax check of user email addresses configurable with a default of "no"
to avoid breaking existing setups.

Modified: rt/3.8/trunk/etc/RT_Config.pm.in
==============================================================================
--- rt/3.8/trunk/etc/RT_Config.pm.in	(original)
+++ rt/3.8/trunk/etc/RT_Config.pm.in	Tue Mar  3 10:43:08 2009
@@ -313,6 +313,16 @@
 
 Set($SenderMustExistInExternalDatabase , undef);
 
+=item C<$ValidateUserEmailAddresses>
+
+If C<$ValidateUserEmailAddresses> is true, RT will refuse to create users with
+an invalid email address (as specified in RFC 2822) or with an email address
+made of multiple email adresses.
+
+=cut
+
+Set($ValidateUserEmailAddresses, undef);
+
 =item C<@MailPlugins>
 
 C<@MailPlugins> is a list of auth plugins for L<RT::Interface::Email>

Modified: rt/3.8/trunk/lib/RT/User_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/User_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/User_Overlay.pm	Tue Mar  3 10:43:08 2009
@@ -530,9 +530,11 @@
     # if the email address is null, it's always valid
     return (1) if ( !$Value || $Value eq "" );
 
-    # We only allow one valid email address
-    my @addresses = Email::Address->parse($Value);
-    return ( 0, $self->loc('Invalid syntax for email address') ) unless ( ( scalar (@addresses) == 1 ) && ( $addresses[0]->address ) );
+    if ( RT->Config->Get('ValidateUserEmailAddresses') ) {
+        # We only allow one valid email address
+        my @addresses = Email::Address->parse($Value);
+        return ( 0, $self->loc('Invalid syntax for email address') ) unless ( ( scalar (@addresses) == 1 ) && ( $addresses[0]->address ) );
+    }
 
 
     my $TempUser = RT::User->new($RT::SystemUser);


More information about the Rt-commit mailing list