当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Auth_Adapter_DbTable::getResultRowObject方法代码示例

本文整理汇总了PHP中Zend_Auth_Adapter_DbTable::getResultRowObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Auth_Adapter_DbTable::getResultRowObject方法的具体用法?PHP Zend_Auth_Adapter_DbTable::getResultRowObject怎么用?PHP Zend_Auth_Adapter_DbTable::getResultRowObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Auth_Adapter_DbTable的用法示例。


在下文中一共展示了Zend_Auth_Adapter_DbTable::getResultRowObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 /**
  * 
  * @throws Zend_Auth_Adapter_Exception If authentication cannot be performed 
  * @return Zend_Auth_Result 
  * @see Zend_Auth_Adapter_Interface::authenticate()
  */
 public function authenticate()
 {
     $result = array('code' => Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, 'identity' => null, 'messages' => array());
     /** @var Zend_Config */
     $config = Zend_Registry::get('config');
     if (isset($config['admin']['pass']) && $this->_data['code'] == $config['admin']['pass'] && $this->_data['email'] == 'admin') {
         $result['code'] = Zend_Auth_Result::SUCCESS;
         $result['identity'] = new Reg2_Model_Identity('admin');
         Zend_Registry::get('log')->info('Admin login from ' . $_SERVER['REMOTE_ADDR']);
         return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
     }
     $this->_dbauth->setIdentity($this->_data['email'])->setCredential($this->_data['code']);
     $dbresult = $this->_dbauth->authenticate();
     if ($dbresult->isValid()) {
         $result['code'] = Zend_Auth_Result::SUCCESS;
         $user = $this->_dbauth->getResultRowObject();
         $result['identity'] = new Reg2_Model_Identity($user->role, $user);
         Zend_Registry::get('log')->info(sprintf("Login with '%s' as '%s'(%d) from %s", $this->_data['email'], $user->role, $user->tid, $_SERVER['REMOTE_ADDR']));
     } else {
         $result['code'] = $dbresult->getCode();
         $result['messages'] = $dbresult->getMessages();
         Zend_Registry::get('log')->info(sprintf("Login attempt: %d from %s", $dbresult->getCode(), $_SERVER['REMOTE_ADDR']));
     }
     return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
 }
开发者ID:smalyshev,项目名称:chgk-teams,代码行数:31,代码来源:Adapter.php

示例2: Login

 /**
  * Login function authentication system 
  * @param Zend_Db_Table_Row $account
  * @return boolean
  */
 function Login(Zend_Db_Table_Row $account)
 {
     $select = $this->select()->where('email=?', $account->email)->limit(1);
     $row = $this->fetchRow($select);
     // set up the auth adapter
     $db = Acl_Model_Account::getDefaultAdapter();
     $authAdapter = new OS_Application_Adapter_Auth($account->email, $account->password);
     $authAdapter = new Zend_Auth_Adapter_DbTable($db);
     $authAdapter->setTableName($this->_name)->setIdentityColumn('email')->setCredentialColumn('password')->setCredentialTreatment('block = 0');
     #->setCredentialTreatment('MD5(?) and block = 0');
     $authAdapter->setIdentity($account->email);
     $authAdapter->setCredential(crypt($account->password, $row->password));
     $result = $authAdapter->authenticate();
     Zend_Session::regenerateId();
     if ($result->isValid()) {
         $auth = Zend_Auth::getInstance();
         $storage = $auth->getStorage();
         $storage->write($authAdapter->getResultRowObject(array('id', 'email', 'registerdate', 'lastvisitdate', 'role_id', 'fullname', 'email_alternative')));
         $account = $this->find($authAdapter->getResultRowObject()->id)->current();
         #$account = $this->createRow( $account->toArray() );
         $account->lastvisitdate = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
         $account->save();
         return true;
     }
     return false;
 }
开发者ID:rogercastaneda,项目名称:owlsys,代码行数:31,代码来源:Account.php

示例3: login

 public function login($email, $senha)
 {
     if ($this->validaLogin($email, $senha)) {
         $data = $this->auth->getResultRowObject(null);
         Zend_Auth::getInstance()->getStorage()->write($data);
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:10,代码来源:LoginBO.php

示例4: isValid

 public function isValid($value, $context = null)
 {
     $value = (string) $value;
     $this->_setValue($value);
     $this->_authAdapter->setIdentity($context[$this->_identityElement]);
     $this->_authAdapter->setCredential($value);
     $result = Zend_Auth::getInstance()->authenticate($this->_authAdapter);
     if ($result->isValid()) {
         Zend_Auth::getInstance()->getStorage()->write($this->_authAdapter->getResultRowObject(null, 'pwd'));
         return true;
     }
     $this->_error(self::LOGIN_FAILS);
     return false;
 }
开发者ID:josmel,项目名称:DevelEntretenimientoEntel,代码行数:14,代码来源:Auth.php

示例5: login

 public function login()
 {
     if ($this->_router->isPostRequest()) {
         if ($_POST['login'] != '' && $_POST['passwd'] != '') {
             $db = Zend_Db_Table::getDefaultAdapter();
             // tworzymy instancję adaptera autoryzacji
             $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'cms_user', 'user_login', 'user_passwd');
             $authAdapter->setIdentity($_POST['login']);
             $authAdapter->setCredential(sha1($_POST['passwd']));
             // sprawdzamy, czy użytkownik jest aktywny
             $authAdapter->setCredentialTreatment("? AND user_active = '1'");
             // autoryzacja
             $result = $authAdapter->authenticate();
             if ($result->isValid()) {
                 $user_data = $authAdapter->getResultRowObject();
                 /*	zapisanie roli zalogowanego uzytkownika	*/
                 $this->_roles = RolesModel::Instance();
                 $role = $this->_roles->getRoleData($user_data->role_id);
                 $user_data->role_code = $role['role_code'];
                 $this->_storage->write($user_data);
                 // ustawienie ACL dla użytkownika
                 $this->_engine->addHttpHeader("Location: /" . $this->_router->getUrl('cms', 'index'));
             } else {
                 $this->_view->error = '1';
             }
         } else {
             $this->_view->error = '1';
         }
     }
     $this->_engine->setToRender('login.tpl');
 }
开发者ID:adammajchrzak,项目名称:silesiamaps,代码行数:31,代码来源:Controller.php

示例6: indexAction

 /**
  * IS: Parameter username, password, remember terdeklarasi
  * FS: Mengirimkan ke viewer: fail,
  *     Session berisi data userId dan username
  * Desc: Fungsi untuk login biasa
  */
 public function indexAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     // Jika request ajax
     //if ($this->_request->isXmlHttpRequest()) {
     // Tidak menggunakan layout dan view
     $this->_helper->layout()->disableLayout();
     $loginForm = new Form_LoginForm();
     if ($this->getRequest()->isPost() and $loginForm->isValid($this->getRequest()->getPost())) {
         // Param
         $username = $this->_getParam('username');
         $password = $this->_getParam('password');
         $remember = $this->_getParam('remember');
         // Menggunakan auth adapter bawaan Zend
         $db = Zend_Db_Table::getDefaultAdapter();
         $authAdapter = new Zend_Auth_Adapter_DbTable($db, "user", 'username', 'password');
         // Set username dan password
         $authAdapter->setIdentity($username);
         $authAdapter->setCredential(md5($password));
         // Authentikasi
         $result = $authAdapter->authenticate();
         // Jika ada
         if ($result->isValid()) {
             // Menggunakan auth adapter bawaan Zend
             $db = Zend_Db_Table::getDefaultAdapter();
             $authAdapter = new Zend_Auth_Adapter_DbTable($db, "user", 'username', 'password', 'activationkey');
             // Set username dan password
             $authAdapter->setIdentity($username);
             $authAdapter->setCredential(md5($password));
             // Authentikasi
             $result = $authAdapter->authenticate();
             $auth = Zend_Auth::getInstance();
             $storage = $auth->getStorage();
             $storage->write($authAdapter->getResultRowObject(array('user_id', 'username', 'activationkey')));
             $identity = $auth->getIdentity();
             if ($this->_hasParam('remember')) {
                 $expire = time() + 1728000;
                 // 20 hari expired
                 $cookiePass = sha1(md5($password) . $identity->activationkey);
                 setcookie('budpar_userId', $identity->user_id, $expire, '/');
                 setcookie('budpar_user', $identity->username, $expire, '/');
                 setcookie('budpar_pass', $cookiePass, $expire, '/');
             }
             // Set Blacklist jika ada
             $this->_setBlacklist($identity->user_id);
             // Set nilai session
             $this->_sess->userId = $identity->user_id;
             $this->_sess->username = $identity->username;
             //echo 'success';
         } else {
             echo 'fail';
             $this->view->fail = true;
             $this->_sess->error = true;
         }
     } else {
         echo 'fail';
         $this->view->fail = true;
     }
     $this->_redirector->gotoUrl($this->_sess->previousUri);
 }
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:66,代码来源:LoginController.php

示例7: loginAction

 public function loginAction()
 {
     $this->_helper->layout->disablelayout();
     $authorization = Zend_Auth::getInstance();
     $identity = $authorization->getIdentity();
     if ($authorization->hasIdentity()) {
         $this->redirect("categories/list");
     }
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getParams();
         $db = Zend_Db_Table::getDefaultAdapter();
         $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'username', 'password');
         $authAdapter->setIdentity($data['username']);
         $authAdapter->setCredential(md5($data['password']));
         $result = $authAdapter->authenticate();
         if ($result->isValid()) {
             $active = (new Application_Model_Users())->getUserByUsername($data['username'])[0]['active'];
             if ($active) {
                 $auth = Zend_Auth::getInstance();
                 $storage = $auth->getStorage();
                 $storage->write($authAdapter->getResultRowObject(array('f_name', 'username', 'id', 'user_type')));
                 $authorization = Zend_Auth::getInstance();
                 $identity = $authorization->getIdentity();
                 $this->view->identity = $identity;
                 $this->redirect('categories/list');
             } else {
                 $this->view->user_msg = "The page not allowed for normal user.";
                 $this->redirect("users/login");
             }
         }
     }
     $form = new Application_Form_Login();
     $this->view->form = $form;
 }
开发者ID:abeinoo,项目名称:Zend,代码行数:34,代码来源:UsersController.php

示例8: loginAction

 public function loginAction()
 {
     //Desabilita renderização da view
     $this->_helper->viewRenderer->setNoRender();
     //Obter o objeto do adaptador para autenticar usando banco de dados
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     //Seta qual tabela e colunas procurar o usuário
     $authAdapter->setTableName('usuario')->setIdentityColumn('login')->setCredentialColumn('senha');
     //Seta as credenciais com dados vindos do formulário de login
     $authAdapter->setIdentity($this->_getParam('login'))->setCredential($this->_getParam('senha'))->setCredentialTreatment('MD5(?)');
     //Realiza autenticação
     $result = $authAdapter->authenticate();
     //Verifica se a autenticação foi válida
     if ($result->isValid()) {
         //Obtém dados do usuário
         $usuario = $authAdapter->getResultRowObject();
         //Armazena seus dados na sessão
         $storage = Zend_Auth::getInstance()->getStorage();
         $storage->write($usuario);
         //Redireciona para o Index
         $this->_redirect('index');
     } else {
         $this->_redirect('autenticacao/falha');
     }
 }
开发者ID:lincolnfatal,项目名称:projetos,代码行数:26,代码来源:AutenticacaoController.php

示例9: authenticate

 public static function authenticate(array $values)
 {
     $email = isset($values['email']) ? $values['email'] : null;
     $senha = isset($values['senha']) ? $values['senha'] : null;
     if (!count($values)) {
         throw new Exception('Não foi passado valores para autenticar');
     }
     // Pegar os dados da autenticacao e checa
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('usuario')->setIdentityColumn('email')->setCredentialColumn('senha');
     $authAdapter->setIdentity($email)->setCredential($senha)->setCredentialTreatment('MD5(?)');
     $select = $authAdapter->getDbSelect();
     $select->join(array('g' => 'grupo'), 'g.id = usuario.grupo_id', array('grupo' => 'nome'));
     //Realiza autenticação
     $result = $authAdapter->authenticate();
     //Verifica se a autenticação foi válida
     if ($result->isValid()) {
         //Obtém dados do usuário
         $usuario = $authAdapter->getResultRowObject();
         //Armazena seus dados na sessão
         $storage = Zend_Auth::getInstance()->getStorage();
         $storage->write($usuario);
         //Redireciona para o Index
         return true;
     }
     return false;
 }
开发者ID:powman,项目名称:zfpadrao,代码行数:28,代码来源:CaAuth.php

示例10: indexAction

 public function indexAction()
 {
     $filter = new Zend_Filter_StripTags();
     $login = trim($filter->filter($this->_request->getPost('login')));
     $senha = trim($filter->filter($this->_request->getPost('senha')));
     $uri = str_replace('kahina/', '', base64_decode($this->_request->getParam('u', base64_encode('painel/index'))));
     if (empty($login) || empty($senha)) {
         $this->view->message = 'Por favor, informe seu Usuário e Senha.';
         return;
     } else {
         $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
         $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
         $authAdapter->setTableName('login')->setIdentityColumn('login')->setCredentialColumn('senha');
         $authAdapter->setIdentity($this->_getParam('login'))->setCredential($this->_getParam('senha'))->setCredentialTreatment('MD5(?)');
         $result = $authAdapter->authenticate();
         if ($result->isValid()) {
             $user = $authAdapter->getResultRowObject();
             $storage = My_Auth::getInstance('Painel')->getStorage();
             $storage->write($user);
             $this->_redirect($uri);
         } else {
             $this->view->error = 'Você deve informar Login e Senha.';
         }
     }
     $this->render();
 }
开发者ID:agenciaaeh,项目名称:kahina,代码行数:26,代码来源:AuthController.php

示例11: logarAction

 /**
  * 
  */
 public function logarAction()
 {
     $resposta = array();
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('sca_usuario')->setIdentityColumn('login_usuario')->setCredentialColumn('password_usuario');
     $authAdapter->setIdentity($this->getRequest()->getParam('login_usuario'))->setCredential($this->getRequest()->getParam('password_usuario'))->setCredentialTreatment('MD5(?) and st_usuario = 1');
     //Realiza autenticacao
     $result = $authAdapter->authenticate();
     //Verifica se a autenticacao foi validada
     if ($result->isValid()) {
         //obtem os dados do usuario
         $usuario = $authAdapter->getResultRowObject();
         //Armazena seus dados na sessao
         $storage = Zend_Auth::getInstance()->getStorage();
         $storage->write($usuario);
         //Redireciona para o Index
         $resposta['situacao'] = "sucess";
         $resposta['msg'] = "Logando aguarde...";
     } else {
         $resposta['situacao'] = "error";
         $resposta['msg'] = "Usuário inativo ou senha incorreta, favor contate ao administrador.";
     }
     echo json_encode($resposta);
 }
开发者ID:powman,项目名称:zfpadrao,代码行数:30,代码来源:CaAuthController.php

示例12: loginAction

 public function loginAction()
 {
     $userForm = new Form_LoginForm();
     $userForm->setAction('/auth/login');
     if ($this->_request->isPost() && $userForm->isValid($_POST)) {
         $data = $userForm->getValues();
         $db = Zend_Db_Table::getDefaultAdapter();
         $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'utils', 'username', 'source');
         $authAdapter->setIdentity($data['username']);
         $authAdapter->setCredential($data['password']);
         $result = $authAdapter->authenticate();
         if ($result->isValid()) {
             $auth = Zend_Auth::getInstance();
             $data1 = $authAdapter->getResultRowObject(null, 'source');
             // $auth->getStorage()->write($data1);
             // $auth->getStorage()->write($data);
             $dom = $auth->getIdentity()->domainadmin;
             $host = $auth->getIdentity()->hostadmin;
             $mySession = SessionWrapper::getInstance();
             $mySession->setSessVar('username', $formData['username']);
             date_default_timezone_set('Europe/Brussels');
             echo 'valid';
         } else {
             $this->view->loginMessage = "Sorry, your username or password was incorrect";
         }
     }
     $this->view->form = $userForm;
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:28,代码来源:AuthController.php

示例13: indexAction

 public function indexAction()
 {
     $form = new Application_Form_Login();
     $form->setAction('/auth');
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $auth = Zend_Auth::getInstance();
             $db = Zend_Registry::get('db');
             $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'username', 'password');
             $authAdapter->setIdentity($formData['username']);
             $authAdapter->setCredential($formData['password']);
             $result = $authAdapter->authenticate();
             $session = Zend_Registry::get('session');
             switch ($result->getCode()) {
                 case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
                     $session->erro = 'senha';
                     $form->populate($formData);
                     break;
                 case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
                     $session->erro = 'Usuario Inválido';
                     $form->populate($formData);
                     break;
                 case Zend_Auth_Result::SUCCESS:
                     $data = $authAdapter->getResultRowObject();
                     $session->role = $data->role;
                     $this->_redirect('/post/retrieve');
                     break;
             }
         } else {
             $form->populate($formData);
         }
     }
     $this->view->form = $form;
 }
开发者ID:rederlo,项目名称:zf_blog,代码行数:35,代码来源:AuthController.php

示例14: logarAction

 public function logarAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $resposta = array();
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('sca_usuario')->setIdentityColumn('login_usuario')->setCredentialColumn('password_usuario')->getDbSelect()->join(array('g' => 'sca_grupo'), 'g.id_grupo = sca_usuario.id_grupo', array('nm_grupo', 'is_root'));
     $authAdapter->setIdentity($this->getRequest()->getParam('login_usuario'))->setCredential($this->getRequest()->getParam('password_usuario'))->setCredentialTreatment('MD5(?) and st_usuario = 1');
     //Realiza autenticacao
     $result = $authAdapter->authenticate();
     //Verifica se a autenticacao foi validada
     if ($result->isValid()) {
         //obtem os dados do usuario
         $usuario = $authAdapter->getResultRowObject();
         //Armazena seus dados na sessao
         $storage = Zend_Auth::getInstance()->getStorage();
         $storage->write($usuario);
         // se não for para lembrar os dados expira a sessao em 30 minutos
         if (!$this->getRequest()->getParam('lembrar')) {
             $session = new Zend_Session_Namespace('Zend_Auth');
             $session->setExpirationSeconds(1800);
         }
         //Redireciona para o Index
         $resposta['situacao'] = "success";
         $resposta['msg'] = "Logando aguarde...";
     } else {
         $resposta['situacao'] = "error";
         $resposta['msg'] = "Usuário inativo ou senha incorreta.";
     }
     echo json_encode($resposta);
 }
开发者ID:powman,项目名称:zfpadrao,代码行数:32,代码来源:IndexController.php

示例15: testGetOmittedResultRow

 /**
  * Ensure that ResultRowObject returns an object has specific omissions
  *
  */
 public function testGetOmittedResultRow()
 {
     $this->_adapter->setIdentity('my_username');
     $this->_adapter->setCredential('my_password');
     $result = $this->_adapter->authenticate();
     $resultRow = $this->_adapter->getResultRowObject(null, 'password');
     $this->assertEquals('O:8:"stdClass":3:{s:2:"id";s:1:"1";s:8:"username";s:11:"my_username";s:9:"real_name";s:12:"My Real Name";}', serialize($resultRow));
 }
开发者ID:travisj,项目名称:zf,代码行数:12,代码来源:BasicSqliteTest.php


注:本文中的Zend_Auth_Adapter_DbTable::getResultRowObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。