[pmwiki-users] two sources for the 'password required' page

Tegan Dowling tmdowling at gmail.com
Tue May 16 08:12:14 CDT 2006


On 5/16/06, Ben Wilson <dausha at gmail.com> wrote:
> On 5/16/06, Tegan Dowling <tmdowling at gmail.com> wrote:
> > On 5/16/06, Dominique Faure <dominique.faure at gmail.com> wrote:
> > > On 5/16/06, Tegan Dowling <tmdowling at gmail.com> wrote:
> > > > On 5/16/06, Dominique Faure <dominique.faure at gmail.com> wrote:
> > > > > On 5/15/06, Tegan Dowling <tmdowling at gmail.com> wrote:
> > > > > > On 5/15/06, Ben Wilson <dausha at gmail.com> wrote:
> > > > > > > On 5/15/06, Tegan Dowling <tmdowling at gmail.com> wrote:
> > > > > > > > There are two sources for the 'password required' page - the first
> > > > > > > > one, the full-screen page, comes from the pmwiki.php file itself, and
> > > > > > > > the other is the wiki page Site/AuthForm.  I'd like to be able to
> > > > > > > > customize the first one - is there anything I can do to tell the wiki
> > > > > > > > to get that content from the wiki page Site/AuthForm as well?
> > > > > > > >
> > > > > > > > OR,
> > > > > > > >
> > > > > > > > If that screen must be generated by pmwiki.php, then I'll edit
> > > > > > > > pmwiki.php, although I don't like to do that, since I'll have to
> > > > > > > > remember to do it again with each upgrade.  If I do, though, is there
> > > > > > > > a way to embed a link in the text I enter there?  I tried
> > > > > > > > [[http://example.com | example]] and I tried <a
> > > > > > > > href="http://example.com">example</a>, and both rendered as plaintext
> > > > > > > > instead of becoming links.
> > > > > > > >
> > > > > > > > Thanks!
> > > > > > > >
> > > > > > > > Tegan
> > > > > > >
> > > > > > > Don't you just have to set $AuthPromptFmt to effect the change you want?
> > > > > > >
> > > > > > > Ben
> > > > > >
> > > > > > Yay:  http://www.pmwiki.org/wiki/Cookbook/MakingPasswordRequestsExplicit
> > > > > > Thanks!
> > > > > >
> > > > >
> > > > > An other (cleanest?) way could be to fill dynamically some text into
> > > > > the (:messages:) markup already present in the Site/AuthForm wiki
> > > > > page:
> > > > >
> > > > > function SetAuthMessage($pagename) {
> > > > >   global $MessagesFmt, $action;
> > > > >   $actionText = array(
> > > > >   'attr' => 'administer',
> > > > >   'upload' => 'upload files related to',
> > > > >   );
> > > > >   $handle = @$actionText[$action];
> > > > >   if(!$handle) $handle = $action;
> > > > >   $MessagesFmt[] =
> > > > >   "<p><i>You need to authenticate yourself to $handle this page.</i></p>";
> > > > > }
> > > > > $AuthPromptFmt = array(&$PageStartFmt,
> > > > >   'function:SetAuthMessage',
> > > > >   'page:{$SiteGroup}.AuthForm',
> > > > >   "<script language='javascript' type='text/javascript'><!--
> > > > >     try { document.authform.authid.focus(); }
> > > > >     catch(e) { document.authform.authpw.focus(); } //--></script>",
> > > > >   &$PageEndFmt);
> > > >
> > > > Where would I put that? In config.php? Or right on the AuthForm?
> > >
> > > You may add it into your config.php. The Site.AuthForm already
> > > contains the affected (:messages:) markup.
> >
> > I put it in config.php. Now when I attempt to access a read -protected
> > page, I get a white screen with this text on it:
> >
> > '''$[Password required]''' (:messages:) (:if enabled InvalidLogin:)*
> > $[Name/password not recognized] (:if:) (:input auth_form:) (:if
> > enabled EnableAuthUser:)$[Name]: (:input text name=authid:)\\
> > (:if:)$[Password]: (:input password name=authpw:) (:input submit
> > value='OK':) (:input end:) <:block>
> >
> Hmm, looks like it's expecting HTML rather than markup. Try
> translating the form to HTML.
>
Dom's modified markup makes the AuthForm page work just fine.  The
problem comes when the situation calls for login to a read-restricted
page; then the other version of the "Password required" page is used -
the version that is just hard-coded into the pmwiki.php file.

I'm going to revert to doing what you (Ben) recommended before -
starting with the material on Cookbook/MakingPasswordRequestsExplicit,
and modifying $AuthPromptFmt without messing with (:messages:).  This
stuff is 1) not documented, 2) not all coordinated in one place, and
3) **Way** the hell over my head.

Thanks, folks, really!  I hope someone else is interested enough to
pursue this, but I'm maxed out.

Tegan




More information about the pmwiki-users mailing list