Created
November 17, 2015 22:35
-
-
Save s7anley/b497c7cd05dec10ee75f to your computer and use it in GitHub Desktop.
Revisions
-
s7anley created this gist
Nov 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ <?php class Base_Auth_Adapter_BcryptDbTable extends Zend_Auth_Adapter_DbTable { /** * @inheritdoc */ protected function _authenticateCreateSelect() { $dbSelect = clone $this->getDbSelect(); $dbSelect->from($this->_tableName) ->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity); return $dbSelect; } /** * @inheritdoc */ protected function _authenticateValidateResult($resultIdentity) { $passwordCheck = password_verify($this->_credential, $resultIdentity[$this->_credentialColumn]); if (!$passwordCheck) { $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; $this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; return $this->_authenticateCreateAuthResult(); } $this->_resultRow = $resultIdentity; $this->_authenticateResultInfo['code'] = Zend_Auth_Result::SUCCESS; $this->_authenticateResultInfo['messages'][] = 'Authentication successful.'; return $this->_authenticateCreateAuthResult(); } }