/** * Authenticate a user * * @param array $credentials Matched pair array containing email/passwd * @return boolean */ public function authenticate($credentials) { $adapter = $this->getAuthAdapter($credentials); $auth = $this->getAuth(); $result = $auth->authenticate($adapter); if (!$result->isValid()) { return false; } $user = $this->_userModel->getUserByEmail($credentials['email']); $auth->getStorage()->write($user); return true; }
/** * Authenticate a user * * @param array $data Matched pair array containing email/password * @return boolean */ public function authenticate($data) { $adapter = $this->getAuthAdapter($data); $auth = $this->getAuth(); $result = $auth->authenticate($adapter); if (!$result->isValid()) { return false; } if ($data['save-login']) { Zend_Session::rememberMe(); } else { Zend_Session::forgetMe(); } $user = $this->_userModel->findByEmail($data['email']); $auth->getStorage()->write($user->toArray()); return true; }