diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 37a16e17f..d8e05bf7d 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -713,6 +713,14 @@ sub process_user : Private { my $user_title = Utils::trim_text( $params{fms_extra_title} ); + if ( $c->cobrand->allow_anonymous_reports ) { + my $anon_details = $c->cobrand->anonymous_account; + + for my $key ( qw( email name ) ) { + $params{ $key } ||= $anon_details->{ $key }; + } + } + # The user is already signed in if ( $c->user_exists ) { my $user = $c->user->obj; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 670e49469..7fbe0b518 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -766,5 +766,23 @@ If true then we never send an email to confirm a report sub never_confirm_reports { 0; } +=head2 allow_anonymous_reports + +If true then can have reports that are truely anonymous - i.e with no email or name. You +need to also put details in the anonymous_account function too. + +=cut + +sub allow_anonymous_reports { 0; } + +=head2 anonymous_account + +Details to use for anonymous reports. This should return a hashref with an email and +a name key + +=cut + +sub anonymous_account { undef; } + 1; |