Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework] zend_auth problem z odczytem danych
kociupk
post 22.03.2010, 18:27:58
Post #1





Grupa: Zarejestrowani
Postów: 97
Pomógł: 1
Dołączył: 29.03.2006

Ostrzeżenie: (0%)
-----


mam problem z odczytem danych ktore zostaly zapisane do sesji
  1. public function indexAction()
  2. {
  3. if(Zend_Auth::getInstance()->hasIdentity())
  4. {
  5. $this->_redirect('profile/index/edit');
  6. }
  7.  
  8.  
  9. $form = new App_Form_Login();
  10. $formData = array();
  11.  
  12. if($this->getRequest()->isPost())
  13. {
  14. $formData = $this->getRequest()->getPost();
  15.  
  16. if($form->isValid($formData))
  17. {
  18. $auth = Zend_Auth::getInstance();
  19.  
  20. $authAdabter = new Zend_Auth_Adapter_DbTable(
  21. Zend_Registry::get('db'),
  22. 'portal_user',
  23. 'user_name',
  24. 'user_password',
  25. 'MD5(?) and active = 1'
  26. );
  27.  
  28. $authAdabter->setIdentity($form->getValue('user_name'))
  29. ->setCredential($form->getValue('user_password'));
  30.  
  31. $result = $auth->authenticate($authAdabter);
  32.  
  33. if($result->isValid())
  34. {
  35. $userObj = $authAdabter->getResultRowObject('null', 'user_password');
  36.  
  37. $auth->getStorage()->write($userObj);
  38.  
  39. $this->_redirect('profile/index/edit');
  40. } else {
  41. $errorMessage = 'Nieprawidlowe login lub haslo!';
  42. }
  43.  
  44. }
  45. }
  46. $this->view->error = $errorMessage;
  47. $this->view->form = $form;
  48. }

i tak odczytuje
  1. $user = Zend_Auth::getInstance()->getIdentity()->user_id;

Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.06.2025 - 15:17