【发布时间】:2013-07-03 09:48:19
【问题描述】:
到现在为止,我已经以纯文本形式存储了所有密码,因为该网站没有上线,我决定等待新的password api。
我有此代码可用于纯文本密码:
<?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;
根据docs,我应该实现自己的适配器,并且可能只是更改为使用password_verify()。
我在这里错过了一切如何协同工作的大图。
我的问题是:
- 我应该修改女巫对象吗?
$authAdaper或$auth
任何高级(或低级:D)示例代码都将不胜感激。
一切顺利 亚当
【问题讨论】:
标签: php zend-framework zend-auth php-password-hash