diff options
author | Dave Arter <davea@mysociety.org> | 2017-04-07 14:07:08 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2017-04-10 14:21:54 +0100 |
commit | 430f17de7b4af94e52152bf11a30bd423a7a1c34 (patch) | |
tree | 1a59ed076561b34d8c018bc845a0183f4b64f3a4 /perllib | |
parent | 880acad342b69720fe7acd54e0e7cede7036e4c7 (diff) |
Allow comma-separated contact emails in the admin
The report-sending code has allowed multiple emails for a long time, but the
admin wouldn't allow you to enter multiple emails for each contact.
Fixes mysociety/FixMyStreet-Commercial#835
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index d37e0b39c..c49cafe7d 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -7,7 +7,7 @@ BEGIN { extends 'Catalyst::Controller'; } use Path::Class; use POSIX qw(strftime strcoll); use Digest::SHA qw(sha1_hex); -use mySociety::EmailUtil qw(is_valid_email); +use mySociety::EmailUtil qw(is_valid_email is_valid_email_list); use mySociety::ArrayUtils; use DateTime::Format::Strptime; use List::Util 'first'; @@ -357,10 +357,11 @@ sub update_contacts : Private { } ); - my $email = $self->trim( $c->get_param('email') ); + my $email = $c->get_param('email'); + $email =~ s/\s+//g; my $send_method = $c->get_param('send_method') || $contact->send_method || $contact->body->send_method || ""; unless ( $send_method eq 'Open311' ) { - $errors{email} = _('Please enter a valid email') unless is_valid_email($email) || $email eq 'REFUSED'; + $errors{email} = _('Please enter a valid email') unless is_valid_email_list($email) || $email eq 'REFUSED'; } $contact->email( $email ); |