Re: Auth and QuickForm usage problem ?! [reminder]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Auth and QuickForm usage problem ?! [reminder]

Laurent Laville
Hi QA-team

As i've not yet received any anwsers to my question, i request
your help !
Perharps one of you may help me to understand what's wrong.

regards
Laurent Laville


Laurent Laville a ?crit :

> hi all,
>
> i'v try to used Auth-1.2.3 and QuickForm 3.2.4pl1 to generate login
> form, but i've a little problem with applying custom filter.
>
> It's not a QF usage problem: i know this package, but i don't think it's
> such easy to use (its filter feature) with Auth package.
>
> If i'm not wrong (please someone, tell me)
> the Auth::start() method run the Auth::assignData() that set POST data
> just before QF may validate the form (and apply filters).
>
> So it's to late, and data are assigned with no-filtered form datas
>
> Here are the most important code of my script:
>
> My platform: PHP 4.3.10, PEAR 1.3.4, Windows XP, Apache 1.3.3
>
> Is someone may help me to understand if it's a wrong Auth package usage
> or if it's a bug ?
>
> Thanks in advance
> Laurent Laville
>
>
> <?php
>
> // my QF custom filter
> function filterSecure($values)
> {
>     $values = trim($values);
>     $values = strip_tags($values);
>     return $values;
> }
>
> function loginFunction($username, $status, &$auth)
> {
>     require_once 'HTML/QuickForm.php';
>     require_once 'HTML/QuickForm/Renderer/QuickHtml.php';
>
>     $form = new HTML_QuickForm('dauth');
>     [....]
>     $form->applyFilter('__ALL__', 'filterSecure');
>     [....]
>
>     $renderer = new HTML_QuickForm_Renderer_QuickHtml();
>     $form->accept($renderer);
>
>     $html_template = '
> ................ the form template itself ......
> ';
>     echo $renderer->toHtml($html_template);
>     $form->validate();
> }
>
> $storageDriver = 'File';
> $options = 'passwd.file';
> $loginFunction = 'loginFunction';
>
> $a = new Auth($storageDriver, $options, $loginFunction);
> $a->start();
>
> if ($a->checkAuth()) {
>     echo 'welcome '.$a->getUsername();
> }
> ?>

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php