开发者

How to add credential column in authentication adepter using ZF

开发者 https://www.devze.com 2023-01-29 17:01 出处:网络
My开发者_运维知识库 auth adapter is like below $authAdapter->setTableName(\'register\') ->setIdentityColumn(\'username\')

My开发者_运维知识库 auth adapter is like below

 $authAdapter->setTableName('register')
                        ->setIdentityColumn('username')
                        ->setCredentialColumn('pwd');

It's working fine :

but now i want to check status column active/inactive also.

How can we add one more credential column here ?


You could use setCredentialTreatment() method

$authAdapter->setTableName('register')
            ->setIdentityColumn('username')
            ->setCredentialColumn('pwd')
            ->setCredentialTreatment('? AND status = "active"');


$select = $authAdapter->getDbSelect();
$select->where('status = "active"');
$authAdapter->authenticate();

Have a look at the documentation, under the Advanced Usage By Example heading.

0

精彩评论

暂无评论...
验证码 换一张
取 消