Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#145 2023-03-10 19:29:41

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

Re: smd_access_keys: secure, limited access to content

Hmm, looks reasonable. Stick your site in debugging mode and refresh the page, with and without the key(s) / section mode in the URL. Then view source on each. If you hunt in the stack trace for the smd_akey / smd_access_key entries you should see a chunk where the smd_access_protect is called.

Straight after that will be what it pulled form the URL and the corresponding DB query. Then the result of the trigger test. Check that the URL and trigger exactly match, and compare them to the corresponding entry in the database smd_akey table (match on the t_hex). Then see what the result is in the stack trace. It should report true or false. This might give us a clue why it’s failing.

In general, you only need section mode if you’re protecting an entire section of your site. If you’re protecting an article you should be able to get away without it.

EDIT: also, what’s the URL scheme of the section that you’re protecting?

Last edited by Bloke (2023-03-10 19:34:06)


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

#146 2023-03-10 19:49:37

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 252
Website

Re: smd_access_keys: secure, limited access to content

Thanks.

Plain url:

    135.13 |     1.96 | 	<txp:smd_access_protect trigger="test" force="partial">
    135.19 |     1.84 | 		[SQL: SHOW columns FROM smd_akeys ]
    137.03 |          | 		[Rows: 8]
    137.05 |          | 		[smd_access_key URL elements: https:||domain.com|etc|professional-access]
    137.06 |          | 		[smd_access_key trigger: test]
    137.07 |          | 		[false]
    137.07 |     0.02 | 		<txp:smd_if_access_error type="smd_akey_err_forbidden">
    137.08 |          | 			[true]
    137.09 |          | 		</txp:smd_if_access_error>
    137.09 |          | 	</txp:smd_access_protect>

Url with key:

    136.79 |     1.48 | 	<txp:smd_access_protect trigger="test" force="partial">
    136.84 |     1.30 | 		[SQL: SHOW columns FROM smd_akeys ]
    138.14 |          | 		[Rows: 8]
    138.19 |          | 		[smd_access_key URL elements: https:||domain.com|etc|professional-access?test|3492257933d99276d24517fece7b28a31d777958|640b881e]
    138.20 |          | 		[smd_access_key trigger: test]
    138.22 |          | 		[false]
    138.23 |     0.04 | 		<txp:smd_if_access_error type="smd_akey_err_forbidden">
    138.26 |          | 			[true]
    138.27 |          | 		</txp:smd_if_access_error>
    138.27 |          | 	</txp:smd_access_protect>

Both key and trigger match. The url scheme is section/title

Last edited by giz (2023-03-10 19:53:42)

Offline

#147 2023-03-10 20:01:16

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

Re: smd_access_keys: secure, limited access to content

So the plain URL is behaving as expected. The one with the ? In the URL isn’t, and that might be because it’s not acting as a section mode key.

When you say “convert to section mode” did you edit the smd_access_protect tag to add section_mode="1"? Without that, it’ll still be trying to match on slash.


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

#148 2023-03-10 20:28:06

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 252
Website

Re: smd_access_keys: secure, limited access to content

That did it :)

I remember trying section_mode=“1” in the smd_access_protect tag earlier, but obviously something else I’d done was preventing it from working then.

Thanks for all your help!

Offline

#149 2023-03-10 20:32:48

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

Re: smd_access_keys: secure, limited access to content

No worries, got there in the end. Sorry for the hassles.


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

Board footer

Powered by FluxBB