aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Schema/Misc.pm
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-09-09 03:33:09 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-09-09 03:33:09 +0200
commit42c3fc18e894841e6578b5814405b41946b64639 (patch)
tree2fe2317ed655d3feb9410a20d285be70af643b57 /lib/Fripost/Schema/Misc.pm
parenta2df8385c36f166d65a447aab4e081961abad5a2 (diff)
wibble
Diffstat (limited to 'lib/Fripost/Schema/Misc.pm')
-rw-r--r--lib/Fripost/Schema/Misc.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Fripost/Schema/Misc.pm b/lib/Fripost/Schema/Misc.pm
index be88385..384f919 100644
--- a/lib/Fripost/Schema/Misc.pm
+++ b/lib/Fripost/Schema/Misc.pm
@@ -96,9 +96,9 @@ sub email_valid {
my %options = @_;
my $i = $in;
- $i =~ s/.*<([^>]+)>.*/$1/;
+ $i =~ s/^[^<>]+\s<([^>]+)>/$1/;
my $mesg = $options{'-error'} // "Invalid e-mail";
- $in = $options{'-prefix'}.$in if defined $options{'-prefix'};
+ $in = $options{'-prefix'}.$i if defined $options{'-prefix'};
my $addr = Email::Valid::->address( -address => $in,
-tldcheck => 1,
@@ -106,6 +106,7 @@ sub email_valid {
my $match = defined $addr;
$match &&= $addr eq $in if $options{'-exact'};
die $mesg." ‘".$i."‘\n" unless $match;
+ $addr =~ s/^$options{'-prefix'}// if defined $options{'-prefix'};
return $addr;
}