aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-01-26 14:34:47 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-01-26 14:34:47 +0000
commitac59f93b2228f5ff77ca7b7aff6fc3be54d360cd (patch)
tree3b6e7fb937526aeb05b11d14cfcff0b30e531e73
parent251a0e77a25e5efb45aedca27a141f006dbddbde (diff)
Improve some error pages.
Use design of auth/token in generic error, 404, and token server error pages, and use the same error for too old/ token not found errors.
-rw-r--r--perllib/FixMyStreet/App/Controller/Tokens.pm6
-rw-r--r--t/app/controller/questionnaire.t2
-rwxr-xr-xtemplates/web/base/errors/generic.html9
-rw-r--r--templates/web/base/errors/page_error_404_not_found.html20
-rw-r--r--templates/web/base/tokens/error.html12
5 files changed, 20 insertions, 29 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm
index c10904f8f..b1d60fe32 100644
--- a/perllib/FixMyStreet/App/Controller/Tokens.pm
+++ b/perllib/FixMyStreet/App/Controller/Tokens.pm
@@ -324,11 +324,7 @@ sub load_auth_token : Private {
}
);
- unless ( $token ) {
- $c->stash->{template} = 'errors/generic.html';
- $c->stash->{message} = _("I'm afraid we couldn't validate that token. If you've copied the URL from an email, please check that you copied it exactly.\n");
- $c->detach;
- }
+ $c->detach('token_too_old') unless $token;
return $token;
}
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index 2a89454d5..7718d5034 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -87,7 +87,7 @@ foreach my $test (
{
desc => 'User goes to questionnaire URL with a bad token',
token_extra => 'BAD',
- content => "we couldn't validate that token",
+ content => "Sorry, that wasn&rsquo;t a valid link",
},
{
desc => 'User goes to questionnaire URL for a now-hidden problem',
diff --git a/templates/web/base/errors/generic.html b/templates/web/base/errors/generic.html
index 12aa8e170..d0d1e2e00 100755
--- a/templates/web/base/errors/generic.html
+++ b/templates/web/base/errors/generic.html
@@ -1,8 +1,9 @@
-[% INCLUDE 'header.html', title = loc('Error') %]
+[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Error') %]
-<h1>[% loc('Error') %]</h1>
-
-<p>[% message %]</p>
+<div class="confirmation-header confirmation-header--failure">
+ <h1>[% loc('Error') %]</h1>
+ <p>[% message %]</p>
+</div>
[% INCLUDE 'footer.html' %]
diff --git a/templates/web/base/errors/page_error_404_not_found.html b/templates/web/base/errors/page_error_404_not_found.html
index 77db18e89..490c5b721 100644
--- a/templates/web/base/errors/page_error_404_not_found.html
+++ b/templates/web/base/errors/page_error_404_not_found.html
@@ -1,19 +1,13 @@
-[% INCLUDE 'header.html', title => loc('Page Not Found') %]
+[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Page Not Found') %]
-<h1>[%loc('Page Not Found') %]</h1>
-
-[% IF error_msg %]
+<div class="confirmation-header confirmation-header--failure">
+ <h1>[% loc('Page Not Found') %]</h1>
+ [% IF error_msg %]
<p class="error">[% error_msg | html %]</p>
-[% END %]
+ [% END %]
-<p>
- [%
- tprintf(
- loc("The requested URL '%s' was not found on this server"),
- c.req.uri
- )
- %]
-</p>
+ <p>[% tprintf(loc("The requested URL '%s' was not found on this server"), c.req.uri) %]</p>
+</div>
[% # FIXME - add more helpful suggestions to this page %]
diff --git a/templates/web/base/tokens/error.html b/templates/web/base/tokens/error.html
index e3fa6c170..726ec1598 100644
--- a/templates/web/base/tokens/error.html
+++ b/templates/web/base/tokens/error.html
@@ -1,9 +1,9 @@
-[% INCLUDE 'header.html', title => loc('Error') %]
+[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Error') %]
+[% contact_url = c.uri_for('/contact') %]
-<h1>[% loc('Error') %]</h1>
-
-[% contact_url = c.uri_for('/contact'); %]
-
-<p>[% tprintf( loc('Thank you for trying to confirm your update or problem. We seem to have an error ourselves though, so <a href="%s">please let us know what went on</a> and we\'ll look into it.'), contact_url ) %]</p>
+<div class="confirmation-header confirmation-header--failure">
+ <h1>[% loc('Error') %]</h1>
+ <p>[% tprintf( loc('Thank you for trying to confirm your update or problem. We seem to have an error ourselves though, so <a href="%s">please let us know what went on</a> and we\'ll look into it.'), contact_url ) %]</p>
+</div>
[% INCLUDE 'footer.html' %]