0

Hi good morning to everyone here, I have the following code which always returns me the value 'direccion' on the view, but I would like to retrieve all the values ​​of the vase of data and put it to the meeting, as I can do that, they are thank you in advance.

Controller:

$authAdapter = new Zend_Auth_Adapter_DbTable();

$authAdapter
    ->setTableName('credential')
    ->setIdentityColumn('email')
    ->setCredentialColumn('password')
    ->setIdentityColumn('direccion');

$authAdapter
    ->setIdentity($form->getValue('email'))
    ->setCredential($form->getValue('password'))
    ->setIdentity('San marcos');
    $select = $authAdapter->getDbSelect();
            $select->where('status = "1"');

$auth = Zend_Auth::getInstance();

$result = $auth->authenticate($authAdapter);

View:

if (Zend_Auth::getInstance()->hasIdentity()) {
    $username = Zend_Auth::getInstance()->getIdentity();
    $profile = 'Welcome, ' . var_dump($username) . ' <a href="/auth/public/user/logout">logout</a>';
} else {
user3680708
  • 117
  • 2
  • 9

1 Answers1

0

You can write your own LoginStorage class for the current user on zend_auth. In this way, when you authenticate the user, write you LoginStorage with your custom values on Zend_auth.

Something like this:

<?php
//LoginStorage custom class
class LoginStorage {

public function __construct ($direccion){
     $this->direccion = $direccion;
}

public $direccion;

}

So when you are running auth:

...
if (Zend_Auth::getInstance()->authenticate($myAuthAdapter)->isValid()) {

   //Instance of UNIQUE auth -> get session writer to record authentication rowset
   Zend_Auth::getInstance()->getStorage()->write(new LoginStorage($myDireccionForThisUser));
...

Now, when you get Zend_Auth::getInstance()->getStorage()->read(), there you be a LoginStorage object ready for you.

fkupper
  • 520
  • 3
  • 9