Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
0.6.2
About It:
Get it:
Rate it:
  • Helpful?
  • 4 Yes
  • 3 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

ign_password_protect

I had a need for password protection for a project I’ve been working on, and the limited functionality of Textpattern’s existing <txp:password_protect /> simply wasn’t cutting it for me.

I reused a lot of the existing authentication code, tweaking it to meet my needs, so a big thanks goes out to Dean et al, for making this easier to knock out. Currently this authenticates users against the txp_users table, so users are created in the site_admin tab. For users that shouldn’t have admin access at all, simply use Privilege level “none” (the default).

This features the following tags: ign_password_protect and ign_logged_user

ign_password_protect – use to password protect part or all of a txp website against users in the txp_user database (on the site_admin tab). can be used in page or form templates, or even directly within an article.

Accepted parameters:

privs: comma separated list of privilege levels to compare against. If omitted, plugin simply
checks for account existence (including privs = None).

err_msg: replaces error message on bad logins

login_msg: use this to set the greeting message that is displayed above the form

class: use this to set the class assigned to the div containing the form; default value is ign_login

remember: boolean to display checkbox for “remember me”, set to 1 or true to display check box (and set persistent cookie)
set to anything else or omit entirely to disable.

ign_logged_user – displays logged in user name with link to log out if logged in.

Accepted parameters:

logged_msg: replaces default “not logged in” message.

Example usage:
<txp:ign_password_protect privs="1,2,3,4,7" login_msg="Please log in to view this resource" remember="true"> Some content to protect here </txp:ign_password_protect>

Version 0.6.2 features:

This version features a significantly re-written authentication mechanism, and more importantly, support for an alternate database. In addition, this version features a number of new tags:

<txp:ign_if_logged_in></txp:ign_if_logged_in>

Conditional to test the state of the login, includes support for <txp:else />. Accepts one parameter, privs.

<txp:ign_self_edit />

Displays a form to allow logged-in users to change their password.

Accepts the following parameters: class, title, onClick, size, tab, id

<txp:ign_page_privs />

Use at the top of a page to set page-wide privilege levels. Useful for enforcing privilege levels across multiple protected elements on a page, as opposed to specifiying privs on each element. Privs set on individual elements will override these global privs.
Accepts one parameter: privs

Download the plugin – ign_password_protect_0.6.2.txt

Or grab the source from github:
https://github.com/igneramos/ign_password_protect

Article Request Count:
Initially released:
2005-06-02
Posted here:
21 Jul 2005

You know you want to visit the Archives.
Published with Textpattern