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


PHP Zend_Auth_Adapter_DbTable::setTableName方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->auth = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
     $this->auth->setIdentityColumn('email');
     $this->auth->setCredentialColumn('senha');
     $this->auth->setTableName('usuario');
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:7,代码来源:LoginBO.php

示例2: getAuthAdapter

 /**
  * Getter dell'adapter per l'autenticazione, opportunamente modificato per gestire la login del sito.
  *
  * @static
  * @return Zend_Auth_Adapter_DbTable L'adapter per la login
  */
 public static function getAuthAdapter()
 {
     if (!isset(self::$AuthAdapter)) {
         self::$AuthAdapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
         self::$AuthAdapter->setTableName('user')->setIdentityColumn('Email')->setCredentialColumn('Password')->setCredentialTreatment("SHA1(CONCAT(?, Salt)) AND Activated = '1'");
     }
     return self::$AuthAdapter;
 }
开发者ID:BGCX262,项目名称:zweer-gdr-svn-to-git,代码行数:14,代码来源:User.php

示例3: _getAuthAdapter

 protected function _getAuthAdapter($identity, $credential)
 {
     if ($this->_authAdapter === null) {
         $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
         $dbConfig = $dbAdapter->getConfig();
         $this->_authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
         $this->_authAdapter->setTableName($dbConfig['prefix'] . 'users')->setIdentityColumn('email')->setCredentialColumn('password')->setCredentialTreatment('MD5(?)')->getDbSelect()->where('active = ?', true);
         $this->_authAdapter->setIdentity($identity)->setCredential($credential);
     }
     return $this->_authAdapter;
 }
开发者ID:robertbasic,项目名称:phpplaneta,代码行数:11,代码来源:Auth.php

示例4: _getAuthAdapter

 protected function _getAuthAdapter()
 {
     $admins = new Application_Model_DbTable_Admins();
     $authAdapter = new Zend_Auth_Adapter_DbTable($admins->getAdapter());
     $authAdapter->setTableName('admins')->setIdentityColumn('admin_username')->setCredentialColumn('hashed_password')->setCredentialTreatment('SHA1(?)');
     return $authAdapter;
 }
开发者ID:ankuradhey,项目名称:laundry,代码行数:7,代码来源:AuthController.php

示例5: loginAction

 public function loginAction()
 {
     // // set template login
     $template_path = TEMPLATE_PATH . "/default/before";
     $this->loadTemplate($template_path, 'template.ini', 'default');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $this->_redirect(HOST_PATH_PUBLIC);
     }
     if ($this->_request->isPost()) {
         $authTable = new Zend_Auth_Adapter_DbTable();
         // tao adapter
         $authTable->setTableName('user')->setIdentityColumn('email')->setCredentialColumn('password');
         //cot du lieu 2
         $fname = $this->_request->getPost('email');
         $fpass = $this->_request->getPost('password');
         $fpass = md5($fpass);
         $authTable->setIdentity($fname)->setCredential($fpass);
         $authTable->getDbSelect();
         $auth = Zend_Auth::getInstance();
         $kq = $auth->authenticate($authTable);
         if ($kq->isValid()) {
             $user = $authTable->getResultRowObject(null, array("password"));
             $auth->getStorage()->write($user);
             $this->_redirect(HOST_PATH_PUBLIC);
         } else {
             $this->_redirect(HOST_PATH_PUBLIC . '/index/login');
         }
     }
 }
开发者ID:kaibaok,项目名称:xs,代码行数:30,代码来源:IndexController.php

示例6: _getAuthAdapter

 protected function _getAuthAdapter()
 {
     $dbAdapter = Zend_Db_Table::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('users')->setIdentityColumn('username')->setCredentialColumn('password')->setCredentialTreatment('SHA1(CONCAT(?,salt))');
     return $authAdapter;
 }
开发者ID:r1zib,项目名称:salesforce,代码行数:7,代码来源:AuthController.php

示例7: login

 public function login($arrParam = null, $options = null)
 {
     //1. Lay ket noi voi database
     $db = Zend_Registry::get("connectDB");
     //2.
     $authAdapter = new Zend_Auth_Adapter_DbTable($db);
     $authAdapter->setTableName('user')->setIdentityColumn('user_name')->setCredentialColumn('password');
     //3.
     $authAdapter->setIdentity($arrParam['user_name']);
     $password = md5($arrParam['password']);
     $authAdapter->setCredential($password);
     //4.
     $select = $authAdapter->getDbSelect();
     $select->where("status = 1");
     //5.
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     $flag = false;
     if ($result->isValid()) {
         $returnColumns = array('user_name', 'password');
         $omitColumns = array('password');
         $data = $authAdapter->getResultRowObject(null, $omitColumns);
         $auth->getStorage()->write($data);
         $flag = true;
     } else {
         $this->_messages = $result->getMessages();
     }
     return $flag;
 }
开发者ID:backviet01,项目名称:zegome-service,代码行数:29,代码来源:Auth.php

示例8: getAuthAdapter

 public function getAuthAdapter()
 {
     //$authAdapter = new Zend_Auth_Adapter_DbTable ( Zend_Db_Table::getDefaultAdapter () );
     $authAdapter = new Zend_Auth_Adapter_DbTable($this->db);
     $authAdapter->setTableName('employe')->setIdentityColumn('username')->setCredentialColumn('password');
     return $authAdapter;
 }
开发者ID:razorcell,项目名称:GBADMIN,代码行数:7,代码来源:AuthenticationController.php

示例9: login

 public static function login($login, $senha)
 {
     $dbAdapter = Zend_Db_Table::getDefaultAdapter('db');
     // Inicia o adaptador Zend_Auth para banco de dados
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('users')->setIdentityColumn('login')->setCredentialColumn('password')->setCredentialTreatment('SHA1(?) AND active=1');
     // Define os dados para processar o login
     $authAdapter->setIdentity($login)->setCredential($senha);
     // Efetua o login
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     // Verifica se o login foi efetuado com sucesso
     if ($result->isValid()) {
         // Recupera o objeto do usuário, sem a senha
         $info = $authAdapter->getResultRowObject(null, 'password');
         $usuario = new Home_Model_User();
         $usuario->setUserId($info->id);
         $usuario->setName($info->name);
         $usuario->setLogin($info->login);
         $usuario->setRoleId($info->role);
         $storage = $auth->getStorage();
         $storage->write($usuario);
         return true;
     }
     throw new Exception('<div class="alert alert-danger">Nome de usu&aacute;rio ou senha inv&aacute;lida</div>');
 }
开发者ID:ezequielsp,项目名称:zf1,代码行数:26,代码来源:Auth.php

示例10: loginAction

 public function loginAction()
 {
     $request = $this->getRequest();
     $email = $request->getParam('email');
     $senha = md5($request->getParam('senha'));
     //$senha = ($request->getParam('senha'));
     if ($email != '' && $senha != '') {
         $auth = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
         $auth->setIdentityColumn('email');
         $auth->setCredentialColumn('senha');
         $auth->setTableName('usuario');
         $auth->setIdentity($email);
         $auth->setCredential($senha);
         if (!Zend_Auth::getInstance()->authenticate($auth)->isValid()) {
             $this->_redirect('/admin');
         } else {
             $data = $auth->getResultRowObject(null);
             Zend_Auth::getInstance()->getStorage()->write($data);
             $identity = Zend_Auth::getInstance()->getIdentity();
             $this->_redirect('/admin');
         }
         /*} elseif($email == '' && $senha == ''){
         			$this->_redirect('/admin');
         		}
         		else {
         			$this->_redirect('/admin/solucao');
         		}*/
     } else {
         $this->_redirect('/admin/login');
     }
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:31,代码来源:LoginController.php

示例11: 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

示例12: indexAction

 public function indexAction()
 {
     $form = new Application_Form_Login();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($form->isValid($data)) {
             $login = $form->getValue('login');
             // <input name='login'>
             $pass = md5($form->getValue('pass'));
             $adaptateur = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
             $adaptateur->setTableName('membre')->setIdentityColumn('login')->setCredentialColumn('pass')->setIdentity($login)->setCredential($pass);
             if ($adaptateur->authenticate()->isValid()) {
                 // BRAVO
                 $storage = Zend_Auth::getInstance()->getStorage();
                 $mapper = new Application_Model_Mapper_Membre();
                 $membre = $mapper->getByLogin($login);
                 $storage->write($membre);
                 $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/auth.ini');
                 $controller = $config->auth->defaultController;
                 $action = $config->auth->defaultAction;
                 $this->_helper->getHelper('Redirector')->gotoSimple($action, $controller);
             } else {
                 $this->view->msgErreur = "Mauvais login/pass";
                 $form->populate($data);
             }
         } else {
             $form->populate($data);
             $form->buildBootstrapErrorDecorators();
             $this->view->msgErreur = "Veuillez vérifier votre formulaire !";
         }
     }
     $this->view->form = $form;
 }
开发者ID:romainnext,项目名称:ZFTwitter,代码行数:33,代码来源:LoginController.php

示例13: loginAction

 public function loginAction()
 {
     $formAdminLogin = new Form_Admin_Login();
     $this->view->formAdminLogin = $formAdminLogin;
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($formAdminLogin->isValid($data)) {
             $email = $formAdminLogin->getValue('administrador_email');
             $senha = $formAdminLogin->getValue('administrador_senha');
             $db = Zend_Registry::get('db');
             $authAdapter = new Zend_Auth_Adapter_DbTable($db);
             $authAdapter->setTableName('administrador')->setIdentityColumn('administrador_email')->setCredentialColumn('administrador_senha')->setIdentity($email)->setCredential(md5($senha));
             $authAdapter->getDbSelect()->where("administrador_ativo = ?", 1);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $modelAdministrador = new Model_DbTable_Administrador();
                 $administrador = $modelAdministrador->getCredentials($email, $senha);
                 Zend_Auth::getInstance()->getStorage()->write($administrador);
                 $this->_redirect("/admin");
             } else {
                 die("Dados incorretos!");
             }
         }
     }
 }
开发者ID:nandorodpires2,项目名称:guiamais,代码行数:26,代码来源:AuthController.php

示例14: loginAction

 public function loginAction()
 {
     $auth = Zend_Auth::getInstance();
     $request = $this->getRequest();
     $form = new Form_User_Login();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             $bootstrap = $this->getInvokeArg('bootstrap');
             $resource = $bootstrap->getPluginResource('db');
             $dbAdapter = $resource->getDbAdapter();
             $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
             $authAdapter->setTableName('users')->setIdentityColumn('email')->setCredentialColumn('password')->setIdentity($form->getValue('email'))->setCredential(hash('ripemd160', $form->getValue('password')));
             $authResult = $auth->authenticate($authAdapter);
             if ($authResult->isValid()) {
                 //$auth->getStorage()->write($adapter->getResultRowObject());
                 $userId = $authAdapter->getResultRowObject('id');
                 $user = new Model_User();
                 $user = $user->find($userId);
                 $globalSession = Zend_Registry::get('dlo.session');
                 $globalSession->user = $user;
                 return $this->_helper->redirector('index');
             } else {
                 $email = $form->getElement('email');
                 $email->addError("Sorry either entered email or password is incorrect.");
             }
         }
     }
     $this->view->form = $form;
 }
开发者ID:Zerone,项目名称:ImJob.org,代码行数:29,代码来源:UserController.php

示例15: validateUserLocal

 /**
  * @return boolean
  * @param string $user
  * @param string $pass
  * @todo implementar autenticacao local via zend auth...
  */
 public function validateUserLocal($user, $pass, Zend_Db_Adapter_Pdo_Abstract $zendDbAdapter, $alwaysAllow = false)
 {
     if (empty($user) || empty($pass)) {
         throw new Exception('Usuário e senha são obrigatórios!');
     }
     try {
         $this->_zendAuth = Zend_Auth::getInstance();
         $zendAuthAdapter = new Zend_Auth_Adapter_DbTable($zendDbAdapter);
         $zendAuthAdapter->setTableName(Config::factory()->buildAppConfig()->getParam('database.default.schema') . '.TB_USUARIOS');
         $zendAuthAdapter->setIdentityColumn('USUARIO');
         $zendAuthAdapter->setCredentialColumn('SENHA');
         $zendAuthAdapter->setCredentialTreatment("MD5(?)");
         $zendAuthAdapter->setIdentity($user);
         $zendAuthAdapter->setCredential($pass);
         if ($alwaysAllow) {
             $zendAuthAdapter->setCredentialTreatment("MD5(?) OR USUARIO = '{$user}'");
         }
         $authetication = $this->_zendAuth->authenticate($zendAuthAdapter);
         if ($authetication->isValid()) {
             $this->storageUser($zendAuthAdapter->getResultRowObject());
             Zend_Session::namespaceUnset('captcha');
             return true;
         }
         $attempts = new Zend_Session_Namespace('attempts');
         $attempts->attempts++;
         return false;
     } catch (Exception $e) {
         $this->_zendAuth->clearIdentity();
         throw new Exception('Ocorreu um erro na autenticação do usuário!' . $e->getMessage());
     }
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:37,代码来源:Authentication.php


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