remove WebGUI::Utility::emailRegex

This commit is contained in:
Graham Knop 2010-08-20 12:22:33 -05:00
parent 10aa605304
commit a34f51a903
5 changed files with 5 additions and 24 deletions

View file

@ -8,6 +8,7 @@ use WebGUI::International;
use WebGUI::Pluggable;
use WebGUI::Utility;
use Tie::IxHash;
use Email::Valid;
use base qw/WebGUI::Account/;
=head1 NAME
@ -908,7 +909,7 @@ sub www_inviteUserSave {
my $db = $session->db;
my @toList = split /[;,]/, $to;
for my $inviteeEmail (@toList) {
unless ( $inviteeEmail =~ WebGUI::Utility::emailRegex ) {
unless ( Email::Valid->address($inviteeEmail) ) {
return $self->www_inviteUser( sprintf $i18n->get('invalid email'), $inviteeEmail );
}

View file

@ -18,6 +18,7 @@ use strict;
use base 'WebGUI::Form::Text';
use WebGUI::International;
use WebGUI::Utility;
use Email::Valid;
=head1 NAME
@ -66,7 +67,7 @@ An optional value to process instead of POST input.
sub getValue {
my $self = shift;
my $value = @_ ? shift : $self->session->form->param($self->get("name"));
if ($value =~ WebGUI::Utility::emailRegex) {
if (Email::Valid->address($value)) {
return $value;
}
return undef;

View file

@ -57,20 +57,6 @@ These subroutines are available from this package:
=cut
#-------------------------------------------------------------------
=head2 emailRegex ( )
Returns a regex object that can be used to validate email addresses.
=cut
sub emailRegex {
return qr/^([0-9a-zA-Z]+[-._+&])*\w+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,7}$/;
}
#-------------------------------------------------------------------
=head2 isBetween ( value, first, second )