Auth and QuickForm usage problem ?!
| From: | Laurent Laville | Date: | Sat, 30 Apr 2005 15:43:04 +0000 |
| Subject: | Auth and QuickForm usage problem ?! | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-37459@lists.php.net to get a copy of this message | ||
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();} ?>