aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-03-15 16:07:50 +0000
committerStruan Donald <struan@exo.org.uk>2012-03-15 16:07:50 +0000
commitf67d9298a0727e44cf2ba12d9d58ee57973ebef0 (patch)
treeea8d5fd9a67b1ebf41ee0de5dd9fc29176d8c343 /perllib/FixMyStreet/App/Controller/Report/New.pm
parent7c6ba5a5dac101bc7ac1629471162123ac204427 (diff)
first pass of using password to loging. needs lots of work still
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 724e84a41..70dee63c6 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -126,6 +126,7 @@ sub report_new_ajax : Path('mobile') : Args(0) {
unless ($c->forward('check_for_errors')) {
$c->stash->{ json_response } = { errors => $c->stash->{field_errors} };
+ $c->stash->{ json_response }->{check_name} = $c->user->name if $c->stash->{check_name};
$c->forward('send_json_response');
return 1;
}
@@ -141,12 +142,16 @@ sub report_new_ajax : Path('mobile') : Args(0) {
id => $report->id
}
} );
- $c->stash->{token_url} = $c->uri_for_email( '/P', $token->token );
- $c->send_email( 'problem-confirm.txt', {
- to => [ [ $report->user->email, $report->name ] ],
- } );
+ if ( $report->confirmed ) {
+ $c->stash->{ json_response } = { success => 1, report => $report->id };
+ } else {
+ $c->stash->{token_url} = $c->uri_for_email( '/P', $token->token );
+ $c->send_email( 'problem-confirm.txt', {
+ to => [ [ $report->user->email, $report->name ] ],
+ } );
+ $c->stash->{ json_response } = { success => 1 };
+ }
- $c->stash->{ json_response } = { success => 1 };
$c->forward('send_json_response');
}
@@ -156,7 +161,6 @@ sub send_json_response : Private {
my $body = JSON->new->utf8(1)->encode(
$c->stash->{json_response},
);
-
$c->res->content_type('application/json; charset=utf-8');
$c->res->body($body);
}
@@ -712,6 +716,7 @@ sub process_user : Private {
my $user = $c->user->obj;
$report->user( $user );
$report->name( $user->name );
+ $c->stash->{check_name} = 1;
$c->stash->{field_errors}->{name} = _('You have successfully signed in; please check and confirm your details are accurate:');
$c->log->info($user->id . ' logged in during problem creation');
return 1;