diff options
author | Struan Donald <struan@exo.org.uk> | 2011-05-23 09:08:12 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-05-23 09:08:12 +0100 |
commit | 55d0afab34953d266824448d279d72787bfd6e07 (patch) | |
tree | 9640df781c74088cb512c0d1ca4f9c8ee5fd950b /perllib/FixMyStreet/App/Controller/Tokens.pm | |
parent | c62870edf51e1bfe04ad11256bd7ba8b5a4ee5d5 (diff) | |
parent | 8fbb9539e8ada7faf6c54c40bda7d059bdfd0c12 (diff) |
Merge branch 'migrate_to_catalyst' of ssh://git.mysociety.org/data/git/public/fixmystreet into migrate_to_catalyst
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Tokens.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Tokens.pm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm index 1c3d89b54..7053edc95 100644 --- a/perllib/FixMyStreet/App/Controller/Tokens.pm +++ b/perllib/FixMyStreet/App/Controller/Tokens.pm @@ -156,6 +156,24 @@ sub confirm_update : Path('/C') { return 1; } +sub load_questionnaire_id : Private { + my ( $self, $c, $token_code ) = @_; + + # Set up error handling + $c->stash->{error_template} = 'questionnaire/error.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"); + + my $auth_token = $c->forward( 'load_auth_token', [ $token_code, 'questionnaire' ] ); + $c->stash->{id} = $auth_token->data; + $c->stash->{token} = $token_code; +} + +sub questionnaire : Path('/Q') : Args(1) { + my ( $self, $c, $token_code ) = @_; + $c->forward( 'load_questionnaire_id', [ $token_code ] ); + $c->forward( '/questionnaire/index'); +} + =head2 load_auth_token my $auth_token = @@ -193,7 +211,7 @@ Display an error page saying that there is something wrong with the token. sub token_error : Private { my ( $self, $c ) = @_; - $c->stash->{template} = 'tokens/error.html'; + $c->stash->{template} = $c->stash->{error_template} || 'tokens/error.html'; $c->detach; } |