ZF2 Authentication with extra column

How to authenticate using Username, Password and extra Column (status) in Zendframework 2?

There two different ways to add additional column authentication in ZF2

1. Using doctrine, create a plugin and customize this adapter

2. using dbAdapter

$adapter = new AuthAdapter($db,
                           'users',
                           'username',
                           'password',
                           'MD5(?)'
                           );

// get select object (by reference)
$select = $adapter->getDbSelect();
$select->where('active = "TRUE"');

// authenticate, this ensures that users.active = TRUE
$adapter->authenticate();

 Reference

Leave a Reply

Your email address will not be published. Required fields are marked *


9 × = fifty four