diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-05-21 00:12:42 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-05-21 00:12:42 +0100 |
commit | c804762c2fa0b855fca4c2388c6a47f09913b966 (patch) | |
tree | 09b90e602aa3239fc8dc4a4046afbe63e8edec9b /perllib/FixMyStreet/App/Controller/Tokens.pm | |
parent | 4af1e3d75ae247fd7d6a9910087fc36e1a9659f5 (diff) |
Start of questionnaire migration, displays mostly okay, submission not done, nor problem display.
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; } |