Cześć, mam problem, stworzyłem sobie formularz do logowania i samo logowanie:
class Frontend_UserController extends Zend_Controller_Action
{
public function init()
{
// pobranie informacji czy uzytkownik jest juz zalogowany
$auth = Zend_Auth::getInstance();
// sprawdzenie czy zalogowany
if ( $auth->hasIdentity() ) {
}
}
public function indexAction()
{
// action body
}
public function loginAction()
{
// porabrane instancji Zend_Auth
$auth = Zend_Auth::getInstance();
// sprawdzenie czy jest zalogowany
if ( $auth->hasIdentity() ) {
$this->_redirect('/frontend/');
} else if ( $this->getRequest()->isPost() ) {
// sprawdzenie wyslanych danych przez POST
$login = $this->getRequest()->getPost('login');
$pass = $this->getRequest()->getPost('pass');
$dbAdapter = Zend_Db_Table::getDefaultAdapter(); // domysle polaczenie z baza
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('user')
->setIdentityColumn('login')
->setCredentialColumn('pass');
// ->setCredentialTreatment('salt');
// przekazanie danych i sprawdzenie w bazie
$authAdapter
->setIdentity($login)
->setCredential($pass);
$authAdapter->authenticate($dbAdapter);
if ($authAdapter->authenticate()->isValid()) {
} else {
}
//return $authAdapter->authenticate();
//var_dump($authAdapter);
}
$this->view->formularz = new Frontend_Form_Login();
}
}
I teraz wprowadzam dane i mam komunikat, że dane są poprawne. Po odświeżeniu strony dalej mam formularz i brak informacji, że jestem zalogowany. Co źle robię