This may seem like a silly question, but in this code, where would I insert the condition 'WHERE state=1'
public function loginByUsernameAndPassword($username, $password)
{
$this->_auth_adapter = new Zend_Auth_Adapter_DbTable( $this->getAdapter() );
$this->_auth_adapter->setTableName('zend_administration_user')
->setIdentityColumn('user_nm')
->setCredentialColumn('password')
->setCredentialTreatment('SHA1(CONCAT(?,salt))');
$this->_auth_adapter->setIdentity($username)
->setCredential($password);
$result = Zend_Auth::getInstance()->authenticate($this->_auth_adapter);
return $result->isValid();
}
Based on an example in the zf manual, I would say you could add AND state=1
into your setCredentialTreatment() method:
->setCredentialTreatment('SHA1(CONCAT(?,salt)) AND state = 1');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With