MakingPasswordRequestsExplicit

Summary: How can we tell which password is requested?
Version: 1.0
Prerequisites: PmWiki 2.0
Status:
Maintainer:
Categories: Security Layout

PmWiki version tested: 2.0.beta36

Question

How can we tell which password is requested?

Answer

Place the following in local/config.php:

For version pmwiki 2.0.beta29 to 2.0.beta36:

 $AuthPromptFmt=array(&$PageStartFmt,
 "<p><b>A password is required to ".
    ($_GET['action']=='upload'?" reach file uploads":
     ($_GET['action']=='attr'?"administer":
      ($_GET['action']==edit?"edit":
       "read"))." this page")."</b></p>
      <form name='authform' action='{$_SERVER['REQUEST_URI']}' method='post'>
        Password: <input tabindex='1' type='password' name='authpw' value='' />
        <input type='submit' value='OK' />$postvars</form>
        If you forgot your password, please contact ...
        <script language='javascript'><!--
          document.authform.authpw.focus() //--></script>", &$PageEndFmt);

For pmwiki version ... up to 2.0.beta28

 $SessionAuthFmt=array(&$HTMLStartFmt,
    "<p><b>Password required to ".
    ($_GET['action']=='upload'?"upload a file":
     ($_GET['action']=='attr'?"administer":
      ($_GET['action']==edit?"edit":
       "read"))." this page")."</b></p>
      <form name='authform' action='{$_SERVER['REQUEST_URI']}' method='post'>
        Password: <input tabindex='1' type='password' name='authpw' value='' />
        <input type='submit' value='OK' />$postvars</form>
        If you forgot your password, please contact ...
       <script language='javascript'><!--
          document.authform.authpw.focus() //--></script>", &$HTMLEndFmt);

Notes

See Also

For including a similar conditional text in a page or template, see AuthenticatedAsConditional

History

  • Added link to request password - Radu May 19, 2005, at 09:36 AM
  • Added upload, fixed parentheses - Radu March 16, 2005, at 02:28 PM

Contributors

Comments

See discussion at MakingPasswordRequestsExplicit-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.