Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

OpenPass

Summary:Set a global password which is openly displayed to reduce spam
Version: 2008-08-24
Prerequisites:
Status: Alpha
Maintainer: Peter Bowers
Categories: Spam Security Passwords

Questions answered by this recipe

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

  • How can I set a global password to resist spambots but make sure humans are informed of the password?

Description

Set a global "edit" password to prevent spambots but make sure human authors know the password.

Notes

The purpose of this recipe is to display a message in the AuthForm so that users can see the open password if that is the password which is active for this page. But if the page is protected by a page-level or group-level password (i.e., not the "public" or "open" site-level password) then we don't want the message to display.

Installation

  • Set a global password for editing in config.php:
    $DefaultPasswd['edit'] = 'myopenpass';
  • Edit Site.AuthForm so that it will display the password. Add this text on that page in the location you want the message to appear (obviously change the wording as you wish):
(:if equal {$editpass} "site" :)%red%(If you don't know a password for this page, try entering "myopenpass" 
(without the quotes).%%  This is an '''open''' password to prevent spamming by robots but still allow 
you [as a human who can read the page and follow instructions] to make changes.)(:ifend:)
  • Create the PV "editpass" by adding these lines to your config.php:
if ($action == 'edit') {
   $FmtPV['$editpass'] = 'MyPasswdVar($pagename,"edit")';
}
function MyPasswdVar($pagename, $level) {
  global $PCache, $PasswdVarAuth, $FmtV;
  $page = $PCache[$pagename];
  if (!isset($page['=passwd'][$level])) {
    $page = RetrieveAuthPage($pagename, 'ALWAYS', false, READPAGE_CURRENT);
    if ($page) PCache($pagename, $page);
  }
  $pwsource = $page['=pwsource'][$level];
  if (strncmp($pwsource, 'cascade:', 8) == 0)
    return( substr($pwsource, 8));
  return ($pwsource);
}

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

  • 2008-08-24: Initial version

See Also

Contributors

Function based off of PasswdVar from pmwiki.php, thus credit to PM.

Comments

Edit - History - Print - Recent Changes - Search
Page last modified on August 24, 2008, at 04:06 AM