diff options
author | Struan Donald <struan@exo.org.uk> | 2018-10-23 11:08:18 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-10-23 15:50:20 +0100 |
commit | a94e6feb1c2da0a2387f4e4c26cd0d6832a15116 (patch) | |
tree | cc6265a9cefd5ef9c736d3898b058a2545b66c5c /perllib/FixMyStreet/App/Controller/Report/New.pm | |
parent | c73e8b5485c4016921777b95582bbe92853f5e4c (diff) |
use submitted phone number and email in login form
do not use details directly from user object because in the slim chance
that the user has phone and email verified and there is a failed email
login we display the phone number from the database.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index f057a31f6..1a1a657a9 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -481,6 +481,9 @@ sub initialize_report : Private { # save the token to delete at the end $c->stash->{partial_token} = $token if $report; + $c->stash->{email} = $report->user->email; + $c->stash->{phone} = $report->user->phone_display; + } else { # no point keeping it if it is done. $token->delete; @@ -807,6 +810,9 @@ sub process_user : Private { $report->user( $user ); $c->forward('update_user', [ \%params ]); + $c->stash->{phone} = $report->user->phone_display; + $c->stash->{email} = $report->user->email; + if ($c->stash->{contributing_as_body} or $c->stash->{contributing_as_anonymous_user}) { $report->name($user->from_body->name); $user->name($user->from_body->name) unless $user->name; @@ -832,6 +838,10 @@ sub process_user : Private { $c->forward('update_user', [ \%params ]); + $c->stash->{phone} = Utils::trim_text( $type eq 'phone' ? $report->user->phone_display : $params{phone} ); + $c->stash->{email} = Utils::trim_text( $type eq 'email' ? $report->user->email : $params{email} ); + + # The user is trying to sign in. We only care about username from the params. if ( $c->get_param('submit_sign_in') || $c->get_param('password_sign_in') ) { $c->stash->{tfa_data} = { |