[vhffs-dev] [2233] Allowed dot '.' char in mailinglist local part.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2233
Author:   lau
Date:     2013-08-18 16:19:15 +0200 (Sun, 18 Aug 2013)
Log Message:
-----------
Allowed dot '.' char in mailinglist local part.

Modified Paths:
--------------
    trunk/vhffs-api/examples/create_list.pl
    trunk/vhffs-api/src/Vhffs/Constants.pm
    trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm

Modified: trunk/vhffs-api/examples/create_list.pl
===================================================================
--- trunk/vhffs-api/examples/create_list.pl	2013-07-04 21:12:32 UTC (rev 2232)
+++ trunk/vhffs-api/examples/create_list.pl	2013-08-18 14:19:15 UTC (rev 2233)
@@ -14,16 +14,16 @@
 
 my $vhffs = new Vhffs;
 
-die("Usage: $0 localpart domain admin_email description owner_username owner_groupname\n") unless(@ARGV == 6);
+die("Usage: $0 localpart domain description owner_username owner_groupname\n") unless(@ARGV == 5);
 
-my ($local, $domain, $admin, $description, $username, $groupname) = @ARGV;
+my ($local, $domain, $description, $username, $groupname) = @ARGV;
 
 my $user = Vhffs::User::get_by_username($vhffs, $username);
 die("User not found\n") unless(defined $user);
 my $group = Vhffs::Group::get_by_groupname($vhffs, $groupname);
 die("Group not found\n") unless(defined $group);
 
-my $mail = Vhffs::Services::MailingList::create($vhffs, $local, $domain, $admin, $description, $user, $group);
+my $mail = Vhffs::Services::MailingList::create($vhffs, $local, $domain, $description, $user, $group);
 
 if( defined $mail )
 {

Modified: trunk/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Constants.pm	2013-07-04 21:12:32 UTC (rev 2232)
+++ trunk/vhffs-api/src/Vhffs/Constants.pm	2013-08-18 14:19:15 UTC (rev 2233)
@@ -66,6 +66,8 @@
 	ML_POSTING_MEMBERS_ONLY_MODERATED => 4,
 	ML_POSTING_ADMINS_ONLY => 5,
 
+	MAIL_VALID_LOCAL_PART => qr/^[a-z0-9\_\-\.]+$/,
+
 	BROADCAST_WAITING_TO_BE_SENT => 0,
 	BROADCAST_SENT => 1,
 
@@ -245,6 +247,9 @@
 =head2 ML_POSTING_MEMBERS_ONLY_MODERATED
 =head2 ML_POSTING_ADMINS_ONLY
 
+=head1 MAIL CONSTANTS
+=head2 MAIL_VALID_LOCAL_PART
+
 =head1 OBJECT TYPE CONSTANTS
 =head2 TYPE_USER
 =head2 TYPE_GROUP

Modified: trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm	2013-07-04 21:12:32 UTC (rev 2232)
+++ trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm	2013-08-18 14:19:15 UTC (rev 2233)
@@ -155,7 +155,7 @@
 			$panel->add_error( gettext('CGI Error !') );
 		} else {
 			$panel->add_error( gettext('You must enter a description') ) unless $description !~ /^\s*$/;
-			$panel->add_error( gettext('Invalid local part') ) unless $localpart =~ /^[a-z0-9\_\-]+$/;
+			$panel->add_error( gettext('Invalid local part') ) unless $localpart =~ Vhffs::Constants::MAIL_VALID_LOCAL_PART;
 			$mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $domain );
 			$panel->add_error( gettext('You do not own this domain !') ) unless( ($domain eq $default_domain) or $mail->get_group->get_gid == $group->get_gid );
 		}

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2013-07-04 21:12:32 UTC (rev 2232)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2013-08-18 14:19:15 UTC (rev 2233)
@@ -87,7 +87,7 @@
 	my $localpart = shift;
 	my $password = shift;
 
-	return undef unless defined $localpart and $localpart =~ /^[a-z0-9\_\-\.]+$/;
+	return undef unless defined $localpart and $localpart =~ Vhffs::Constants::MAIL_VALID_LOCAL_PART;
 
 	my $query = 'INSERT INTO vhffs_mx_localpart (localpart_id, mx_id, localpart, password, nospam, novirus) VALUES(DEFAULT, ?, ?, ?, DEFAULT, DEFAULT) RETURNING localpart_id,localpart,password,nospam,novirus';
 	my $request = $mail->get_db->prepare( $query );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/