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.

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_COOKIE] => PHPSESSID=m0gh50lpe7uaiv12ob6o1juh30
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2fMakingPasswordRequestsExplicit
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2fMakingPasswordRequestsExplicit
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/MakingPasswordRequestsExplicit
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook/MakingPasswordRequestsExplicit
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afHnmaNjs14HhNw9k7czXAAAAQw
            [REDIRECT_URL] => /wiki/Cookbook/MakingPasswordRequestsExplicit
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 43893
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook/MakingPasswordRequestsExplicit
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/MakingPasswordRequestsExplicit
            [SCRIPT_URL] => /wiki/Cookbook/MakingPasswordRequestsExplicit
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afHnmaNjs14HhNw9k7czXAAAAQw
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777461145.3096
            [REQUEST_TIME] => 1777461145
            [argv] => Array
                (
                    [0] => n=Cookbook%2fMakingPasswordRequestsExplicit
                )

            [argc] => 1
        )

)