修复登录“记住我”功能(ticket #151)

This commit is contained in:
wlx 2011-09-15 06:43:13 +00:00
parent 6ceff06d1a
commit a3fbdb2e20
1 changed files with 4 additions and 4 deletions

View File

@ -162,15 +162,15 @@ class AccountController extends Zend_Controller_Action
->setIdentityColumn('username') ->setIdentityColumn('username')
->setCredentialColumn('password'); ->setCredentialColumn('password');
$authAdapter->setIdentity($u)->setCredential(md5($p)); $authAdapter->setIdentity($u)->setCredential(md5($p));
if ($this->_request->getParam('remember')) {
$authNamespace = new Zend_Session_Namespace('westdc');
$authNamespace->setExpirationSeconds(2592000);
}
$result = $auth->authenticate($authAdapter); $result = $auth->authenticate($authAdapter);
if ($result->isValid()) { if ($result->isValid()) {
// success: store database row to auth's storage // success: store database row to auth's storage
$data = $authAdapter->getResultRowObject(null,'password'); $data = $authAdapter->getResultRowObject(null,'password');
$auth->getStorage()->write($data); $auth->getStorage()->write($data);
if ($this->_request->getParam('remember')) {
$authNamespace = new Zend_Session_Namespace('westdc');
$authNamespace->setExpirationSeconds(2592000);
}
$db->query("update users set ts_last_login=now() where username=?",array($u)); $db->query("update users set ts_last_login=now() where username=?",array($u));
return true; return true;
} }