Page 1 of 1

Protecting a gallery

Posted: 19 Aug 2021, 07:17
by tsommer69
I've used the Protect page to add a link to a specific family gallery and added a username and password.

If I put the same link into a browser, it does prompt for credentials.

However, since the galllery is also available from menus/navigation, and not hidden, I can still navigate to it via the menu, and it then does not prompt for credentials and let's anyone in. I was hoping you could still see if in the menus, but once you clicked on it, the credentials box would pop.

Am I missing something?

Re: Protecting a gallery

Posted: 19 Aug 2021, 07:38
by mjau-mjau
No it should definitely protect access to a given url regardless of how the url is accessed (directly in browser, or from the menu). Keep in mind, logins are remembered as "sessions" by browser, so once you have logged in, you won't need to login again (unless opening from a new/different browser window). If you go to the X3 demo and navigate in the menu > Examples > Features > Password, you can definitely see the login prompt display. Once logged in, the prompt won't display again of course because the browser is already logged in.

The other thing that could interfere, is if you have some unrelated cache mechanism ,for example Cloudflare or Nginx varnish cache. Or if you have set "x3 preload" to manual, you would need to recreate the X3 site object.

I could diagnose further with a link.

Re: Protecting a gallery

Posted: 22 Aug 2021, 08:39
by tsommer69
http://toddsommer.net/galleries/Family/

I just have one picture there so far. I was testing with Chrome in incognito mode.

Re: Protecting a gallery

Posted: 22 Aug 2021, 09:51
by mjau-mjau
Yes I can confirm the issue. Password promt shows when loading the url directly in browser, but when clicking from the menu, it's unprotected. In console, I see "Page from cache [siteDB]", which means the page is somehow added to the site object cache, although that should not happen for password protected pages.

Please try this: Create a new /galleries/test/ page and password protect it. Does the same happen? To diagnose further, I may need to ask for access to your X3 control panel.

Re: Protecting a gallery

Posted: 22 Aug 2021, 17:09
by tsommer69
I created a new Test gallery and put a pic in it like you recommended, and the same appears to happen.

If you need access to my panel, please let me know how I can get it to you securely.

thanks

Re: Protecting a gallery

Posted: 23 Aug 2021, 00:32
by mjau-mjau
PM sent.

I tested locally, just in case, but could not recreate the issue.

Re: Protecting a gallery

Posted: 23 Aug 2021, 15:36
by raydoo
Hey i just got exactly the same Problem for

https://www.ipu2021.fotovonzinner.com

Re: Protecting a gallery

Posted: 23 Aug 2021, 20:23
by mjau-mjau
tsommer69 wrote:I created a new Test gallery and put a pic in it like you recommended, and the same appears to happen.
I have tested, and it works as it's supposed to. When navigating from the MENU to either /Test/ or my folder /pw/, login is prompted:
Image

Re: Protecting a gallery

Posted: 23 Aug 2021, 20:25
by mjau-mjau
raydoo wrote: Hey i just got exactly the same Problem for
Can't confirm. Login is definitely prompted on your password-protected pages. As stated earlier, logins are session-based, so if you already logged in once, you won't be asked to login again naturally. Clicking from menu:
Image
Loading page directly in browser:
Image

Re: Protecting a gallery

Posted: 24 Aug 2021, 06:51
by tsommer69
That's weird, the old one and the new one now prompt properly, didn't yesterday. And you changed nothing?

Re: Protecting a gallery

Posted: 24 Aug 2021, 10:55
by mjau-mjau
Guys, I think I have discovered a circumstantial "bug", and I can recreate the issue you are experiencing following these steps:
  • Create a new page, first without password-protection.
  • Open the website, and navigate TO the page from the menu. The page would now get cached in X3's "site object".
  • In panel, now set a password for the page without making any other changes.
  • If you now open the website, the page will NOT prompt for password when navigating to the newly-protected page, because it's cached in X3's "site object". When loading the page directly in browser however, it will prompt for password as expected, because "site object cache" is only available when navigating from the menu.
In short, this happens if you 1. create a new unprotected page, 2. visit it from browser (from navigation), 3. then set a password without making any other changes anywhere in the website (settings / page settings).
tsommer69 wrote:That's weird, the old one and the new one now prompt properly, didn't yesterday.
Yes, because when I created the new page, it invalidated the "site object cache", which contained your previously unprotected page. Since then, the page will now always correctly prompt for password, because the site object knows not to cache it. It would also have been resolved if I had clicked "save" in settings or page settings.

How to avoid the issue
Make sure to click SAVE (from settings or page settings) after you set password for a page. Either that, or make sure to set the password before you visit the new page. Or if you set a password for the page later on, make sure to also save settings (even if you don't actually make any changes). I think you get the idea ...

I will resolve this circumstantial bug in next X3 release. Thanks!

Re: Protecting a gallery

Posted: 24 Aug 2021, 18:14
by tsommer69
thanks for finding it!

Re: Protecting a gallery

Posted: 16 Jul 2022, 06:07
by mjau-mjau