Small fixes to user model + Form decorators
This commit is contained in:
parent
359e42a44b
commit
49ecfc9fbd
7 changed files with 33 additions and 16 deletions
|
|
@ -77,7 +77,7 @@ class Mapper_User extends Fiktiv_Model_Mapper_DbTableAbstract
|
|||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
// Setup auth adapter
|
||||
$authAdapter = new Zend_Auth_Adapter_DbTable($this->getAdapter(), $this->_name, 'email', 'password');
|
||||
$authAdapter = new Zend_Auth_Adapter_DbTable($this->_dbTable->getAdapter(), $this->_dbTable->_name, 'email', 'password');
|
||||
|
||||
// Set credentials
|
||||
$authAdapter->setIdentity($email);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
class Table_User extends Zend_Db_Table_Abstract
|
||||
class Table_User extends Fiktiv_Db_Table_Abstract
|
||||
{
|
||||
protected $_schema = 'fiktivkod';
|
||||
protected $_name = 'User';
|
||||
protected $_primary = 'id';
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -42,28 +42,17 @@ class AuthController extends Fiktiv_Controller_Action
|
|||
|
||||
if ($this->_request->isPost() && $form->isValid($this->_request->getParams())) {
|
||||
|
||||
$users = new Users();
|
||||
$users = $this->dataService->User;
|
||||
|
||||
if ($users->login($this->_request->getParam('email'), $this->_request->getParam('password'))) {
|
||||
|
||||
// TODO: redirect user
|
||||
$this->_redirect('/');
|
||||
} else {
|
||||
// TODO: Wrong email / password
|
||||
var_dump($emailElement->getErrors());
|
||||
echo "Wrong email / password";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo "You are ";
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$user = $auth->getIdentity();
|
||||
echo $user->firstName;
|
||||
} else {
|
||||
echo "Nobody";
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue