|
Cookbook /
MakingPasswordRequestsExplicitSummary: How can we tell which password is requested?
Version: 1.0
Prerequisites: PmWiki 2.0
Status:
Maintainer:
PmWiki version tested: 2.0.beta36 QuestionHow can we tell which password is requested? AnswerPlace 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 and CommentsIt's up to you to provide a contact, in place of the elipses to:
It may be a hack and there may be more elegant ways to do it The conditional below can be used to override any $fooDoThisFmt string (either in local/config or in skins/SkinName/skin.php) to include the current mode (read, edit, administer - and one can easily add upload if needed): ($_GET['action']=='attr'?"administer":($_GET['action']==edit?"edit":"read")) Neat! This also gives an opportunity to i8n the password dialog along the way. And you can put in extra lines for conditions coming out of other cookbook recipes (RenamePage for one). DirkBlaas Optional image-link - use this: "<p><a href='http://www.pmwiki.org/wiki/PmWiki/PmWiki'><img src='http://www.pmwiki.org/pmwiki/pub/skins/pmwiki/pmwiki-32.gif' alt='Back to HomePage' title='Back to HomePage' /></a> <p><b>A password is required to ". in place of this: "<p><b>A password is required to ". -- TeganDowling See AlsoFor including a similar conditional text in a page or template, see AuthenticatedAsConditional History
Contributors |