Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function indexAction()
- {
- $title = $this->view->title = "Try to login.";
- $this->view->headTitle($title, 'PREPEND');
- $form = new Form_Login;
- $this->view->form = $form;
- if ($this->getRequest()->isPost()) {
- $formData = $this->getRequest()->getPost();
- if ($form->isValid($formData)) {
- $username = $form->getValue('username');
- $password = $form->getValue('password');
- $authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
- $authAdapter
- ->setTableName('users')
- ->setIdentityColumn('username')
- ->setCredentialColumn('password')
- ;
- $authAdapter
- ->setIdentity($username)
- ->setCredential($password)
- ;
- $auth = Zend_Auth::getInstance();
- $result = $auth->authenticate($authAdapter);
- // Print the identity
- //echo $result->getIdentity() . "\n\n";
- // Print the result row
- //print_r($authAdapter->getResultRowObject());
- //$this->_redirect('/');
- } else {
- $form->populate($formData);
- }
- }
- }
Add Comment
Please, Sign In to add comment