aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm1
-rw-r--r--t/app/controller/contact.t2
-rw-r--r--templates/email/default/contact.html5
-rw-r--r--templates/email/default/contact.txt4
5 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ade890b0d..fbdad83f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -39,6 +39,7 @@
- Cobrand hook for presenting custom search results. #2183
- Cobrand hook to allow extra login conditions #2092
- Add ability for client to set bodies not to be sent to.
+ - Include user agent in contact form emails. #2206
* v2.3.4 (7th June 2018)
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 997009b87..3a37d9fa9 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -262,6 +262,7 @@ sub send_email : Private {
my $from = [ $c->stash->{em}, $c->stash->{form_name} ];
my $params = {
to => [ [ $recipient, _($recipient_name) ] ],
+ user_agent => $c->req->user_agent,
};
if (FixMyStreet::Email::test_dmarc($c->stash->{em})) {
$params->{'Reply-To'} = [ $from ];
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index 4f255f058..cb299d161 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -309,7 +309,7 @@ for my $test (
is $email->header('From'), "\"$test->{fields}->{name}\" <$test->{fields}->{em}>", 'from';
my $body = $mech->get_text_body_from_email($email);
like $body, qr/$test->{fields}->{message}/, 'body';
- like $body, qr/Sent by contact.cgi on \S+. IP address (?:\d{1,3}\.){3,}\d{1,3}/, 'body footer';
+ like $body, qr/Sent by contact form on \S+.\s+IP address (?:\d{1,3}\.){3,}\d{1,3}, user agent ./, 'body footer';
my $problem_id = $test->{fields}{id};
like $body, qr/Complaint about report $problem_id/, 'reporting a report'
if $test->{fields}{id};
diff --git a/templates/email/default/contact.html b/templates/email/default/contact.html
index d9e9b060a..8dc9f3af0 100644
--- a/templates/email/default/contact.html
+++ b/templates/email/default/contact.html
@@ -33,6 +33,11 @@ INCLUDE '_email_top.html';
- <a href="[% admin_url %]">Admin</a>
</p>
[%~ END %]
+ [%~ IF user_agent %]
+ <p style="[% secondary_p_style %]">
+ User Agent: [% user_agent | html %]
+ </p>
+ [%~ END %]
</th>
[% INCLUDE '_email_bottom.html' %]
diff --git a/templates/email/default/contact.txt b/templates/email/default/contact.txt
index 6e1fd5ac9..545b1632c 100644
--- a/templates/email/default/contact.txt
+++ b/templates/email/default/contact.txt
@@ -6,4 +6,6 @@ Subject: FMS message: [% subject %]
[ [% complaint %] - [% problem_url %] - [% admin_url %] ]
[% END %]
-[ Sent by contact.cgi on [% host %]. IP address [% ip %] ]
+--
+Sent by contact form on [% host %].
+IP address [% ip %], user agent [% user_agent %]