Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-10-29 07:12:18

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Password protection

Hi,
I need password protection on a part of my site.
In a brand new install of txp 4.8.3 I need password protection on the frontend.
But obviously I cannot get any running:

txp:password_protect doesn’t take my credentials, af far as I understood due to PHP server API: cgi-fcgi in my setup (which I didn’t manage to change).
the I tried cbe_frontauth, which I used before, but it runs into a

Fatal error: Uncaught Error: Call to undefined function txp_validate() in /homepages/36/d518695514/htdocs/evebc.de/textpattern/plugins/cbe_frontauth/cbe_frontauth.php:637 Stack trac

ign_password_protect isn’t working any longer (?)

So I’m lost now: What to do?
In my view the best way would be to get txp:password_protect runnning. Can anyone help me how to do that in a 1and1/ionos-environment, maybe by a htaccess-line?
Or: how to get cbe_frontauth working in txp 4.8.3

Offline

#2 2020-10-29 07:18:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Password protection

What if you just wrap those articles/sections in <txp:if_logged_in />?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2020-10-29 07:24:15

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Password protection

The protected part is for members of the parish (they should get an image gallery with downloads of their family ceremony),
so they aren’t used to txp-admin-side.
And explaining how to login first at admin … too complicated.

If there is something that lets them login in a very simple way from the public-side then I’m happy.
cbe_frontauth could do that, but at the moment I’m not aware how to fix the fatal error.
maybe its a simple addition in the plugin code (registration? or including something?)

Offline

#4 2020-10-29 08:13:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Password protection

You’ll need to:

include_once txpath.'/lib/txplib_admin.php';

Inside any cbe_frontauth function tag code that uses txp_validate. Just add that line at the top of those functions and it should fix it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2020-10-29 08:26:06

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Password protection

Hi, Good morning!
Thanks. Is that mandatory for all functions and plugins?
Because I had another plugin/function with “undefined” core functions – just at the moment I cannot remember where :)

Offline

#6 2020-10-29 08:54:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Password protection

Not all of them, but we moved some “adminish” functions into their own file because txplib_misc was getting very large. Some public plugins, like this one, use admin features so they need to load the admin file to use them.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2020-10-29 09:01:01

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Password protection

Would it solve that globally for a complete plugin if I load it into ied_plugin_compser and tick the “admin”-parts (and reinstall the plugin)?

Or do I have to modify every single function?

Offline

#8 2020-10-29 09:15:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Password protection

No, it won’t help. The plugin flag just tells Txp where to load the plugin. It has no other meaning inside the code: it’s up to the plugin author what happens.

If it’s used many times in many functions, you could add that line near the top of the plugin somewhere so you only need to do it once. It applies to the whole plugin then.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#9 2020-10-29 09:22:23

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Password protection

ah, ok.
Thank you for your help, which was very helpful and releasing me of brain ache just in time!
Have a nice day!

Offline

#10 2020-10-30 04:08:38

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 28

Re: Password protection

This is timely for me as I am building a site where the whole site needs to be password protected. Only people with a registered account can see it.

My plan was to create “authors” with no role and use the password-protect tag to restrict access. But that assumed that password-protect would prompt for a user, not just throw up an Unauthorised message.

So it looks like I need cbe-frontauth plugin, plus some extra work, to achieve what I want. But that plug-in isn’t listed on the Textpattern site. Do you have a link?

Offline

#11 2020-10-30 04:31:10

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 28

Re: Password protection

Ok, found cbe-frontauth. Off to play for a while. I’ll come back here if I get stuck, or to report success.

Offline

#12 2020-10-31 04:25:04

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 28

Re: Password protection

Success! I wrapped the page contents, apart from the site heading, in cbe_frontauth_protect with a login form as the ELSE option.

I must say that Textpattern has a very low swearing to output ratio compared with a lot of other software. You have done well!

Stay safe
Bruce

Offline

Board footer

Powered by FluxBB