aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm6
-rw-r--r--perllib/FixMyStreet/TestMech.pm25
3 files changed, 10 insertions, 27 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 1a1a657a9..ce2fe19f6 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -6,6 +6,7 @@ BEGIN { extends 'Catalyst::Controller'; }
use Encode;
use List::MoreUtils qw(uniq);
+use List::Util 'first';
use POSIX 'strcoll';
use HTML::Entities;
use mySociety::MaPit;
@@ -789,7 +790,10 @@ sub process_user : Private {
# Extract all the params to a hash to make them easier to work with
my %params = map { $_ => $c->get_param($_) }
- ( 'username', 'email', 'name', 'phone', 'password_register', 'fms_extra_title' );
+ ( 'email', 'name', 'phone', 'password_register', 'fms_extra_title' );
+
+ # Report form includes two username fields: #form_username_register and #form_username_sign_in
+ $params{username} = (first { $_ } $c->get_param_list('username')) || '';
if ( $c->cobrand->allow_anonymous_reports ) {
my $anon_details = $c->cobrand->anonymous_account;
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index dc46be61f..cbedf7a01 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -5,6 +5,7 @@ use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
use Path::Class;
+use List::Util 'first';
use Utils;
=head1 NAME
@@ -99,7 +100,10 @@ sub process_user : Private {
# Extract all the params to a hash to make them easier to work with
my %params = map { $_ => $c->get_param($_) }
- ( 'username', 'name', 'password_register', 'fms_extra_title' );
+ ( 'name', 'password_register', 'fms_extra_title' );
+
+ # Update form includes two username fields: #form_username_register and #form_username_sign_in
+ $params{username} = (first { $_ } $c->get_param_list('username')) || '';
# Extra block to use 'last'
if ( $c->user_exists ) { {
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index 495310063..b8605f56c 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -537,31 +537,6 @@ sub visible_form_values {
return \%params;
}
-=head2 session_cookie_expiry
-
- $expiry = $mech->session_cookie_expiry( );
-
-Returns the current expiry time for the session cookie. Might be '0' which
-indicates it expires at end of browser session.
-
-=cut
-
-sub session_cookie_expiry {
- my $mech = shift;
-
- my $cookie_name = 'fixmystreet_app_session';
- my $expires = 'not found';
-
- $mech #
- ->cookie_jar #
- ->scan( sub { $expires = $_[8] if $_[1] eq $cookie_name } );
-
- croak "Could not find cookie '$cookie_name'"
- if $expires && $expires eq 'not found';
-
- return $expires || 0;
-}
-
=head2 get_ok_json
$decoded = $mech->get_ok_json( $url );