Jump to content

Login is going to parent page after logging in on restricted template


DrQuincy
 Share

Recommended Posts

I have two templates: map-submit, map-view. map-views are children templates of a single map-submit template/page and this is enforced in the template Family settings. map-view is set to option B in Access:

Show the Login page

And guest has View pages permission unchecked.

What I want to happen is if you access a map-view page and aren't logged in it shows the login page, you login and then go straight to the specific page you were trying to view. However, this is what happens:

  • Login page is presented
  • On successful login you it takes you to the parent page, the single map-submit page, e.g. login on maps/submit/test-map (map-view) and go go to maps/submit (map-submit)
  • If you visit the page it should've redirected to (maps/submit/test-map) you are presented with the login page again and so on
  • The only thing that seems to work is to login via the usual CMS URL: /processwire/ and then visit the page

I can't see anything in the logs. Any ideas how I can fix this as it's currently a bit clunky for the client?

I don't think I have any unusual modules installed and I have no hooks set up that manipulate the login or the session. I'm on 3.0.184, PHP 7.4.

Thanks.

Link to comment
Share on other sites

I've realised what was causing it:

It is down to the map-view template being set to not have a slash at the end. If I change this it works.

So when it was /maps/submit/test-map and you log in it goes to /maps/submit but when I set it to /maps/submit/test-map/ and you login it, it stays on /maps/submit/test-map/.

Is this a bug and, if not, how can I use URLs with no slash to redirect in this way? In this instance, it doesn't matter as it makes no difference to have a slash at the end. I just wondered really whether it was a limitation, bug or feature as I do like to display homogeneous pages without slashes.

I know you can pass the page ID to /processwire/ and then, I guess, use hooks to redirect to the page but wondered if it really required hooks as it seems like this should be part of the standard access functionality.

Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...