diff options
author | Dave Arter <davea@mysociety.org> | 2019-10-18 14:09:52 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-12-09 12:48:12 +0000 |
commit | 06261194a6c233d9e6f1996c021ca8131469e27a (patch) | |
tree | 62d98b0edf9bce649e16485e6354997ea71ee9f0 /perllib/FixMyStreet/App/Controller/Auth.pm | |
parent | b150f8ac189c9caac3f9853c2c4116e9cb4db44e (diff) |
Include areas in query param for inspector post-login redirect to all reports
Performs a proper redirect instead of detaching to /my/inspector_redirect
so any request params from sign-in (e.g. password!) aren't carried through.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Auth.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Auth.pm | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Auth.pm b/perllib/FixMyStreet/App/Controller/Auth.pm index 4660f45dd..6badbf518 100644 --- a/perllib/FixMyStreet/App/Controller/Auth.pm +++ b/perllib/FixMyStreet/App/Controller/Auth.pm @@ -388,8 +388,11 @@ sub redirect_on_signin : Private { } unless ( $redirect ) { - $c->detach('redirect_to_categories') if $c->user->from_body && scalar @{ $c->user->categories }; - $redirect = 'my'; + my $inspector = $c->user->from_body && ( + scalar @{ $c->user->categories } || + scalar @{ $c->user->area_ids || [] } + ); + $redirect = $inspector ? 'my/inspector_redirect' : 'my'; } $redirect = 'my' if $redirect =~ /^admin/ && !$c->cobrand->admin_allow_user($c->user); if ( $c->cobrand->moniker eq 'zurich' ) { @@ -402,22 +405,6 @@ sub redirect_on_signin : Private { } } -=head2 redirect_to_categories - -Redirects the user to their body's reports page, prefiltered to whatever -categories this user has been assigned to. - -=cut - -sub redirect_to_categories : Private { - my ( $self, $c ) = @_; - - my $categories = $c->user->categories_string; - my $body_short = $c->cobrand->short_name( $c->user->from_body ); - - $c->res->redirect( $c->uri_for( "/reports/" . $body_short, { filter_category => $categories } ) ); -} - =head2 redirect Used when trying to view a page that requires sign in when you're not. |