aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm6
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Develop.pm10
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm3
4 files changed, 17 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 8477dd694..9ce89a9e2 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -7,6 +7,7 @@ BEGIN { extends 'Catalyst::Controller'; }
use MIME::Base64;
use mySociety::EmailUtil;
use FixMyStreet::Email;
+use FixMyStreet::Template::SafeString;
=head1 NAME
@@ -253,8 +254,9 @@ generally required to stash
sub setup_request : Private {
my ( $self, $c ) = @_;
- $c->stash->{contact_email} = $c->cobrand->contact_email;
- $c->stash->{contact_email} =~ s/\@/@/;
+ my $email = $c->cobrand->contact_email;
+ $email =~ s/\@/@/;
+ $c->stash->{contact_email} = FixMyStreet::Template::SafeString->new($email);
for my $param (qw/em subject message/) {
$c->stash->{$param} = $c->get_param($param);
diff --git a/perllib/FixMyStreet/App/Controller/Develop.pm b/perllib/FixMyStreet/App/Controller/Develop.pm
index d2457a3d7..6a1c10b22 100755
--- a/perllib/FixMyStreet/App/Controller/Develop.pm
+++ b/perllib/FixMyStreet/App/Controller/Develop.pm
@@ -142,6 +142,7 @@ sub email_previewer : Path('/_dev/email') : Args(1) {
# Look through the Email::MIME email for the text/html part, and any inline
# images. Turn the images into data: URIs.
+ my $text = '';
my $html = '';
my %images;
$email->walk_parts(sub {
@@ -151,6 +152,8 @@ sub email_previewer : Path('/_dev/email') : Args(1) {
(my $cid = $part->header('Content-ID')) =~ s/[<>]//g;
(my $ct = $part->content_type) =~ s/;.*//;
$images{$cid} = "$ct;base64," . $part->body_raw;
+ } elsif ($part->content_type =~ m[text/plain]i) {
+ $text = $part->body_str;
} elsif ($part->content_type =~ m[text/html]i) {
$html = $part->body_str;
}
@@ -160,7 +163,12 @@ sub email_previewer : Path('/_dev/email') : Args(1) {
$html =~ s/cid:([^"]*)/data:$images{$1}/g;
}
- $c->response->body($html);
+ if ($c->get_param('text')) {
+ $c->response->header(Content_type => 'text/plain');
+ $c->response->body($text);
+ } else {
+ $c->response->body($html);
+ }
}
=item problem_confirm_previewer
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 270ad2ddb..899028ee9 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -4,6 +4,7 @@ use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
+use utf8;
use Encode;
use List::MoreUtils qw(uniq);
use List::Util 'first';
@@ -895,7 +896,7 @@ sub process_user : Private {
oauth_report => { $report->get_inflated_columns }
};
unless ( $c->forward( '/auth/sign_in', [ $params{username} ] ) ) {
- $c->stash->{field_errors}->{password} = _('There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the &lsquo;No&rsquo; section of the form.');
+ $c->stash->{field_errors}->{password} = _('There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the ‘No’ section of the form.');
return 1;
}
my $user = $c->user->obj;
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 1dc337c48..610f0f4eb 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -4,6 +4,7 @@ use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
+use utf8;
use Path::Class;
use List::Util 'first';
use Utils;
@@ -143,7 +144,7 @@ sub process_user : Private {
oauth_update => { $update->get_inflated_columns }
};
unless ( $c->forward( '/auth/sign_in', [ $params{username} ] ) ) {
- $c->stash->{field_errors}->{password} = _('There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the &lsquo;No&rsquo; section of the form.');
+ $c->stash->{field_errors}->{password} = _('There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the ‘No’ section of the form.');
return 1;
}
my $user = $c->user->obj;