Jump to content

Page Protector


adrian

Recommended Posts

Hi @sebr - when I test your module, it saves the the data truncated to 65535 characters. I don't get any error. 

I also tested the module saveModuleConfigData() method with a long string, and again it just truncates it.

All I can think is that there was a DB error during the save which removed the data. Maybe saveModuleConfigData (or actually saveConfig) needs a try catch to make sure an error can't delete data?

Link to comment
Share on other sites

  • 1 month later...

Hi @adrian,

Long time no speak. Quick question. I'm using this method to insert the form into my web page:

if($page->protected) {
	echo $page->loginForm;
} else {
	// show some $page images here
}

The form shows up and I'm able to login but it then shows nothing beyond where the form sits, even if I refresh. Am I missing something?

Cheers
Marty

Link to comment
Share on other sites

Hi @Marty Walker - hope you're well!

I think perhaps you don't quite have things right, but I am really guessing at this point. Keep in mind that if you want to embed into the site you need a dedicated template as defined in the settings and you shouldn't need the if($page->protected)  check.

image.thumb.png.59c159a6ecb6f7e21b5d5ef15b70f054.png

Does that help at all, or am I missing the point entirely?

Link to comment
Share on other sites

Hi Marty,

I think the problem is that you don't want to protect the page that is using the portfolio template. And as I mentioned above you also don't want the if($page->protected)  check.

What you want is to protect the pages that have the images you're trying to restrict access to (using the option on the settings tab). Everything else will be taken care of by the module.

Hope that gets you going and sorry if the instructions aren't clear.

Link to comment
Share on other sites

  • 5 months later...

Hi Adrian:

We have an odd issue that's cropped up with our protected page module. We set up a 'review' access role (essentially a guest role so they need to log in to review a hidden page). It's worked perfectly for a long time and now it doesn't.

People can only view the page if they are logged into the /admin area first, then they can go to the hidden protected page and login there too. This is true even when logging in with super admin creds. 

Both sites (we have more but I'm focusing on these two) are using 7.4 php and 3.0.208 / 3.0.210 PW versions.

What users experience: they go to the protected page link, enter their login creds and submit. The login page reloads rather than letting you through to the page.

The only way to get to the page is to log into the /admin back end first, then logging into the protected page. This is awkward / clumsy for the site visitor who don't need back end access.

I'm wondering if you have ideas on what could be the issue. Is the latest PW version affecting things / conflicting? Or something else we should be looking at?

Link to comment
Share on other sites

  • 1 year later...

Hi @adrian - just wondering with your module is there a way to configure the whole site to be protected, but to exclude one particular page from protection? I can't see a way to do this without having to configure every page 1 by 1, unless I'm missing a trick?

Link to comment
Share on other sites

15 hours ago, adrian said:

@JayGee - not currently. I wonder if the best option might be to make protectedCheck() hookable and then you could add an exception for the required page via a hook in ready.php

 

Thanks @adrian for confirming I wasn't overlooking something obvious at least!

The use case was to protect a staging site but allow certain routes for webhooks/APIs etc. Have worked around it for the moment using basic auth at server level, but it would be a handy feature. Will add it to the backlog and have a look at forking it and making a mod when get some time 🙂 

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
×
×
  • Create New...