AuthorFromPasswordPromptSessions

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Question

How can I fill in the contents of the edit page's "Author" field with a username entered from the password prompt by using sessionauth.php?

Answer

Add the following lines to your local/config.php:

 include_once("$FarmD/scripts/sessionauth.php");
 $AuthRealmFmt = '$Group';
 if (@$_POST['author']) 
   $_SESSION['author'] = $_POST['author'];
 $SessionAuthFmt = "<b>Author and Password for \"$AuthRealmFmt\" are required!</b><p>
  <form name='authform' action='{$_SERVER['REQUEST_URI']}' method='post'>
    <table>
    <tr>
        <td>Author:</td>
        <td><input name='author' value='$author' /></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><input tabindex='1' type='password' name='authpw' value='' /></td>
    </tr>
    <tr>
        <td> </td>
        <td align=right><input type='submit' value='OK' /></td>
    </tr>
    </table>
  </form>";

Bugs

  • I had to add the following line to get it to work correctly: AnthonyLiekens
    if (@$_SESSION['author']) $Author = $_SESSION['author'];

Contributors

pmwiki-2.3.38 -- Last modified by {{AnthonyLiekens}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons