diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Contact.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Contact.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index 926a3f2a5..6bc6e90ef 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -108,11 +108,19 @@ sub validate : Private { if !mySociety::EmailUtil::is_valid_email( $c->req->param('em') ); } + %field_errors = ( + %field_errors, + $c->cobrand->extra_contact_validation($c) + ); + push @errors, _('Illegal ID') if $c->req->param('id') && $c->req->param('id') !~ /^[1-9]\d*$/ or $c->req->param('update_id') && $c->req->param('update_id') !~ /^[1-9]\d*$/; + push @errors, _('There was a problem showing this page. Please try again later.') + if $c->req->params->{message} && $c->req->params->{message} =~ /\[url=|<a/; + unshift @errors, _('There were problems with your report. Please see below.') if scalar keys %field_errors; @@ -146,7 +154,7 @@ sub prepare_params_for_email : Private { my $problem_url = $base_url . '/report/' . $c->stash->{update}->problem_id . '#update_' . $c->stash->{update}->id; - my $admin_url = " - $admin_url" . 'update_edit/' . $c->stash->{update}->id + my $admin_url = " - $admin_url" . '/update_edit/' . $c->stash->{update}->id if $admin_url; $c->stash->{message} .= sprintf( " \n\n[ Complaint about update %d on report %d - %s%s ]", @@ -158,7 +166,7 @@ sub prepare_params_for_email : Private { elsif ( $c->stash->{problem} ) { my $problem_url = $base_url . '/report/' . $c->stash->{problem}->id; - $admin_url = " - $admin_url" . 'report_edit/' . $c->stash->{problem}->id + $admin_url = " - $admin_url" . '/report_edit/' . $c->stash->{problem}->id if $admin_url; $c->stash->{message} .= sprintf( " \n\n[ Complaint about report %d - %s%s ]", @@ -184,7 +192,7 @@ generally required to stash sub setup_request : Private { my ( $self, $c ) = @_; - $c->stash->{contact_email} = $c->cobrand->contact_email( 'contact' ); + $c->stash->{contact_email} = $c->cobrand->contact_email; $c->stash->{contact_email} =~ s/\@/@/; for my $param (qw/em subject message/) { @@ -206,7 +214,7 @@ Sends the email sub send_email : Private { my ( $self, $c ) = @_; - my $recipient = $c->cobrand->contact_email( 'contact' ); + my $recipient = $c->cobrand->contact_email; my $recipient_name = $c->cobrand->contact_name(); $c->stash->{host} = $c->req->header('HOST'); |