remove WebGUI::Utility::emailRegex
This commit is contained in:
parent
10aa605304
commit
a34f51a903
5 changed files with 5 additions and 24 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ checkModule('Package::Stash', );
|
|||
checkModule('HTTP::Exception', );
|
||||
checkModule('Net::Twitter', "3.13006" );
|
||||
checkModule('Number::Format', );
|
||||
checkModule('Email::Valid', );
|
||||
|
||||
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
||||
|
||||
|
|
|
|||
|
|
@ -165,14 +165,6 @@ is(WebGUI::Utility::isInSubnet('192.168.0.1', ['192.257.0.1/32']), undef, 'isInS
|
|||
is(WebGUI::Utility::isInSubnet('192.168.0.1', ['192.168.258.1/32']), undef, 'isInSubnet: ip has an out of range quad');
|
||||
is(WebGUI::Utility::isInSubnet('192.168.0.1', ['192.168.0.259/32']), undef, 'isInSubnet: ip has an out of range quad');
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# emailRegex
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
isa_ok(WebGUI::Utility::emailRegex, 'Regexp');
|
||||
|
||||
TODO: {
|
||||
local $TODO = 'Things to do';
|
||||
ok(0, 'Move email validation tests out of Form/Email into here');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue