AuthUserCookie

Summary: Persistent login for AuthUser
Version: 0.1
Prerequisites: Tested with pmwiki-2.1.3 and build-in AuthUser script
Status:
Maintainer: Elias Soong
Users: (View? / Edit?)
Categories: Security

Goal

If you use the build-in script AuthUser, PmWiki store username and password in session, that means you will be logged out when you close your browser. This module use cookie to help AuthUser have the persistent login ability.

Files

Installation

  • Unpack the distribution file into your PmWiki cookbook directory
  • Add the following lines into your config.php file (Before the including of AuthUser script):
$AuthUserCookieKey = 'abcdefghijklmnopqrstuvwx';
if ($action != 'captchaimage') include_once("$FarmD/cookbook/authusercookie.php");
  • If include authusercookie.php, Captcha do not display on lighttpd with php fastcgi. I don't know the reason, so I use such 'if...' workaround here.
  • Notice you should change $AuthUserCookieKey to be special string other than the one in this example
  • Modify your Site/AuthForm page to add the 'persistent' checkbox to PmWiki's login form, such as:
'''$[Password required]'''
(:messages:)
(:if enabled InvalidLogin:)* $[Name/password not recognized]
(:if:)
(:input auth_form:)
(:if enabled EnableAuthUser:)$[Name]: (:input text name=authid:)\\
(:if:)$[Password]: (:input password name=authpw:)\\
(:if2 enabled AuthUserCookie:)$[Persistent]: (:input checkbox name=persistent checked=true:)\\(:if2:)
(:input submit value='OK':)
(:input end:) 
  • Log out your current account, AuthUserCookie is enabled

Configuration

The following variables can be defined before userauth.php is included in config.php:

$AuthUserCookieExp - The expiration time for the cookie, in seconds. Defaults to 30 days.

Release notes

  • February 25, 2010 - Version 0.1
    • Initial version

See also

Contributors

Comments

This space is for User-contributed commentary and notes. Please include your name and a date (eg 2007-05-19) along with your comment. Optional alternative: create a new page with a name like "ThisRecipe-Talk" (e.g. PmCalendar-Talk).

See discussion at AuthUserCookie-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.