Archived
1
0
Fork 0

Small fixes to user model + Form decorators

This commit is contained in:
Fredric N 2010-09-22 20:50:09 +02:00
parent 359e42a44b
commit 49ecfc9fbd
7 changed files with 33 additions and 16 deletions

View file

@ -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);

View file

@ -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';
}

View file

@ -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;
}

View file

@ -0,0 +1,10 @@
<?php
class Fiktiv_Db_Table_Abstract extends Zend_Db_Table_Abstract
{
public function __get($name)
{
if ('_name' === $name)
return $this->$name;
}
}

6
library/Fiktiv/Form.php Normal file
View file

@ -0,0 +1,6 @@
<?php
class Fiktiv_Form extends Zend_Form
{
}

View file

@ -0,0 +1,6 @@
<?php
abstract class Fiktiv_Form_Decorator_Abstract extends Zend_Form_Decorator_Abstract
{
}

View file

@ -0,0 +1,6 @@
<?php
class Fiktiv_Form_Decorator_Standard extends Fiktiv_Form_Decorator_Abstract
{
}