aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 43ce0e876..3247ad0a1 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -708,22 +708,23 @@ sub process_user : Private {
my $report = $c->stash->{report};
+ # Extract all the params to a hash to make them easier to work with
+ my %params = map { $_ => scalar $c->req->param($_) }
+ ( 'email', 'name', 'phone', 'password_register', 'fms_extra_title' );
+
+ my $user_title = Utils::trim_text( $params{fms_extra_title} );
+
# The user is already signed in
if ( $c->user_exists ) {
my $user = $c->user->obj;
- my %params = map { $_ => scalar $c->req->param($_) } ( 'name', 'phone', 'fms_extra_title' );
$user->name( Utils::trim_text( $params{name} ) ) if $params{name};
$user->phone( Utils::trim_text( $params{phone} ) );
- $user->title( Utils::trim_text( $params{fms_extra_title} ) );
+ $user->title( $user_title ) if $user_title;
$report->user( $user );
$report->name( $user->name );
return 1;
}
- # Extract all the params to a hash to make them easier to work with
- my %params = map { $_ => scalar $c->req->param($_) }
- ( 'email', 'name', 'phone', 'password_register', 'fms_extra_title' );
-
# cleanup the email address
my $email = $params{email} ? lc $params{email} : '';
$email =~ s{\s+}{}g;
@@ -751,7 +752,7 @@ sub process_user : Private {
$report->user->phone( Utils::trim_text( $params{phone} ) );
$report->user->password( Utils::trim_text( $params{password_register} ) )
if $params{password_register};
- $report->user->title( Utils::trim_text( $params{fms_extra_title} ) );
+ $report->user->title( $user_title ) if $user_title;
$report->name( Utils::trim_text( $params{name} ) );
return 1;