aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-11 12:37:59 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-11 12:37:59 +0100
commit6c675d28e4e170ef1fc1d33e5985b706e7431675 (patch)
tree983c700369eea38ecb1f3b5d73d928405ad6303a
parent71ae36012ab91254910247a48824983c3d6a8f37 (diff)
Added 'uri_for_email' method and switched some tokens over to it
-rw-r--r--perllib/FixMyStreet/App.pm21
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm4
-rw-r--r--templates/web/default/email_sent.html1
3 files changed, 24 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 2ae90c2fa..8e6766f58 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -292,6 +292,27 @@ sub send_email {
return $email;
}
+=head2 uri_for_email
+
+ $uri = $c->uri_for_email( ... );
+
+Like C<uri_for> except that it checks the cobrand for an email specific url base
+and uses that.
+
+=cut
+
+sub uri_for_email {
+ my $c = shift;
+ my @args = @_;
+
+ my $normal_uri = $c->uri_for(@_);
+ my $base = $c->cobrand->base_url_for_emails();
+
+ my $email_uri = $base . $normal_uri->path_query;
+
+ return URI->new($email_uri);
+}
+
=head1 SEE ALSO
L<FixMyStreet::App::Controller::Root>, L<Catalyst>
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index c32508cc5..4e077f32b 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -253,7 +253,7 @@ sub report_import : Path('/import') {
->create( { scope => 'partial', data => $report->id } );
$c->stash->{report} = $report;
- $c->stash->{token_url} = $c->uri_for( '/L', $token->token );
+ $c->stash->{token_url} = $c->uri_for_email( '/L', $token->token );
my $sender = mySociety::Config::get('CONTACT_EMAIL');
$sender =~ s/team/fms-DO-NOT-REPLY/;
@@ -1182,7 +1182,7 @@ sub redirect_or_confirm_creation : Private {
my $token =
$c->model("DB::Token")
->create( { scope => 'problem', data => $report->id } );
- $c->stash->{token_url} = $c->uri_for( '/P', $token->token );
+ $c->stash->{token_url} = $c->uri_for_email( '/P', $token->token );
$c->send_email( 'problem-confirm.txt', { to => $report->user->email } );
# tell user that they've been sent an email
diff --git a/templates/web/default/email_sent.html b/templates/web/default/email_sent.html
index bcfcf8617..a20900524 100644
--- a/templates/web/default/email_sent.html
+++ b/templates/web/default/email_sent.html
@@ -20,6 +20,7 @@
}
}
%]
+
<h1>Nearly Done! Now check your email...</h1>
<p>The confirmation email <strong>may</strong> take a few minutes to arrive &mdash; <em>please</em> be patient.</p>