Until now I have stored all passwords in plain text because the site is not live and I decided to wait for the new password api.
I have this code working for passwords in plain text:
<?php
$dbAdapter = Zend_Db_Table::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('account')
->setIdentityColumn('account_id')
->setCredentialColumn('account_password');
// Get our authentication adapter and check credentials
$adapter = $authAdapter;
$adapter->setIdentity($values['account_id']);
$adapter->setCredential($values['password']);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$user = $adapter->getResultRowObject();
$auth->getStorage()->write($user);
return true;
}
return false;
According to docs I should implement my own adapter and probably just change to make use of password_verify().
I'm missing the big picture here to how everything is working together.
My question is:
- Witch object should I modify?
$authAdaper
or$auth
Any high level (or low level :D) example code would be appreciated.
All best Adam