Routers, URLs, and passwords - oh my!

I have been attacking this problem from a variety of angles, but keep running into obstacles. Would greatly appreciate any advice.

I have a site that is password protected on the home page. I cannot have members - only the single password access. Unfortunately this means people can still access the other page content with a direct URL. I would like to prevent the ability to jump to a direct page.

A couple things I’ve tried that haven’t worked:

  • Accessing session variables to determine if a user has logged in to the homepage. Unfortunately using wix-location doesn’t work because it’s too slow. It loads the page first and then redirects. So that led me to routers. Can’t seem to figure out how to get session data to the backend router pages. Is that even possible?
  • Routers. I have tried a number of different techniques with routers. I have tracked if the referring page is internal to the site and if it’s not, I’ll jump back to the homepage. This worked partially, but ran into issues when clicking on things like the “Top” button or image pop-ups from a gallery.
  • I can track the front-end user and the backend user that requested the router, but they are not the same data so can’t seem to use that to track a user across pages. Not sure how to do this without session data (which is not accessible from the router).
  • I’ve tried sending dynamic data via a URL to a blank router page about which page to route to, but that can just be spoofed to get to the final page.

Any other way to send data to a router? Any other way to redirect a page outside of routers and wix-location?

Any thoughts on other options I could try? Hopefully there’s something simple I’m missing. thanks!

2 Likes

Did you try using wix-storage for that ? http://www.wix.com/code/reference/wix-storage.html ?
I would set a key on it “accessAllowed” (or any other name) with a value of true and then read it when loading all other pages to see if the user can access them

Thank you so much for the reply. I have tried wix-storage, and can successfully track a session variable across pages, but I don’t know how to get that key value to the router. Since all of the wix-storage variables are on the front-end, I can’t access them from the router code.

Thoughts?

I’m sorry but you cannot share settings with the router.
Your only option is using site members for this feature

Ok, thank you for the help.

Hi there,
In the same kind of situation, I wanted to access the local storage from the router. I understood that this is nos possible. So I am wondering if I can have access to the headers from the router.
I see that we have partial information from the “request” object, but can I have access to the full header ?

Thanks a lot for your help.

Any solution here? I’m also looking for a way to pass data from page to the router. WixStorage can’t be accessed in the backend. Haven’t found a way to pass data to the request object.