aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Tokens.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Tokens.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Tokens.pm27
1 files changed, 26 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm
index 03dc69b00..44cb2429d 100644
--- a/perllib/FixMyStreet/App/Controller/Tokens.pm
+++ b/perllib/FixMyStreet/App/Controller/Tokens.pm
@@ -53,6 +53,25 @@ sub confirm_problem : Path('/P') {
return;
}
+ # For Zurich, email confirmation simply sets a flag, it does not change the
+ # problem state, log in, or anything else
+ if ($c->cobrand->moniker eq 'zurich') {
+ my $extra = { %{ $problem->extra || {} } };
+ $extra->{email_confirmed} = 1;
+ $problem->update( {
+ extra => $extra,
+ confirmed => \'ms_current_timestamp()',
+ } );
+
+ if ( ref($data) && ( $data->{name} || $data->{password} ) ) {
+ $problem->user->name( $data->{name} ) if $data->{name};
+ $problem->user->phone( $data->{phone} ) if $data->{phone};
+ $problem->user->update;
+ }
+
+ return 1;
+ }
+
# We have a problem - confirm it if needed!
my $old_state = $problem->state;
$problem->update(
@@ -83,6 +102,7 @@ sub confirm_problem : Path('/P') {
$c->res->redirect($report_uri);
}
+ $c->stash->{created_report} = 'fromemail';
return 1;
}
@@ -176,7 +196,12 @@ sub confirm_update : Path('/C') {
$c->authenticate( { email => $comment->user->email }, 'no_password' );
$c->set_session_cookie_expire(0);
- $c->forward('/report/update/confirm');
+ if ( $comment->confirmed ) {
+ my $report_uri = $c->cobrand->base_url_for_report( $comment->problem ) . $comment->problem->url;
+ $c->res->redirect($report_uri);
+ } else {
+ $c->forward('/report/update/confirm');
+ }
return 1;
}