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


PHP Zend_Auth_Adapter_DbTable::setCredentialColumn方法代码示例

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


在下文中一共展示了Zend_Auth_Adapter_DbTable::setCredentialColumn方法的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: login

 /**
  * This method logs in the user
  * Member login
  * @author Kashif Irshad
  * @param string $userName
  * @param string $password in md5 encryption
  * @return string return 'success' for successfully login and all other messages are error message 
  */
 public function login($userName, $password, $remember)
 {
     $userTable = new Application_Model_DbTable_User();
     $authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
     $authAdapter->setTableName('users');
     $authAdapter->setIdentityColumn('username');
     $authAdapter->setCredentialColumn('password');
     $authAdapter->setIdentity($userName);
     $authAdapter->setCredential($password);
     $authAdapter->setAmbiguityIdentity(true);
     $auth = Zend_Auth::getInstance();
     $auth->setStorage(new Zend_Auth_Storage_Session('user'));
     $result = $auth->authenticate($authAdapter);
     if ($result->isValid()) {
         if ($remember > 0) {
             $oneMinute = 60;
             $oneHour = $oneMinute * 60;
             $oneDay = $oneHour * 24;
             $oneWeek = $oneDay * 7;
             $oneMonth = $oneDay * 30;
             Zend_Session::rememberMe($oneWeek);
         }
         return 'success';
     } else {
         $userRow = $userTable->fetchRow("username='{$userName}'");
         if (isset($userRow)) {
             return 'Invalid password';
         } else {
             return 'Invalid username or password';
         }
     }
 }
开发者ID:Genius-Outsourcing-Pvt-Ltd,项目名称:pathology,代码行数:40,代码来源:User.php

示例3: login

 public function login($username, $password)
 {
     $ret = false;
     $filter = new Zend_Filter_StripTags();
     $username = $filter->filter($username);
     $password = $filter->filter($password);
     if (isset($username) && isset($password)) {
         $db = Das_Db::factory();
         $authAdapter = new Zend_Auth_Adapter_DbTable($db);
         $authAdapter->setTableName('v9_user');
         $authAdapter->setIdentityColumn('username');
         $authAdapter->setCredentialColumn('password');
         $authAdapter->setIdentity($username);
         $authAdapter->setCredential($password);
         $result = $this->auth->authenticate($authAdapter);
         if ($result->isValid()) {
             $storage = $this->auth->getStorage();
             // $retObj = $authAdapter->getResultRowObject();
             // $storage->write($retObj->group_id);
             $storage->write($authAdapter->getResultRowObject());
             $ret = true;
         }
     }
     return $ret;
 }
开发者ID:baowzh,项目名称:renfangbaosong,代码行数:25,代码来源:Login.php

示例4: indexAction

 public function indexAction()
 {
     $form = new App_Painel_Form_Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $data = $request->getPost();
             $adapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
             $adapter->setTableName("usuario");
             $adapter->setIdentityColumn("nm_email");
             $adapter->setCredentialColumn("co_senha");
             $adapter->setIdentity($data["usuario"]);
             $adapter->setCredential($data["senha"]);
             $adapter->setCredentialTreatment("MD5(?)");
             $result = $this->auth->authenticate($adapter);
             if ($result->isValid()) {
                 $dados = $adapter->getResultRowObject(null, "co_senha");
                 $dados->sessao = "admin";
                 $this->auth->getStorage()->write($dados);
                 $this->_redirect("/painel");
             } else {
                 $this->view->error = "Email ou Senha incorreto";
             }
         }
     }
     $this->view->form = $form;
 }
开发者ID:alissonpirola,项目名称:site-drandre,代码行数:27,代码来源:LoginController.php

示例5: loginAction

 function loginAction()
 {
     $this->view->message = '';
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $f = new Zend_Filter_StripTags();
         $username = $f->filter($this->_request->getPost('username'));
         $password = md5($f->filter($this->_request->getPost('password')));
         if (!empty($username)) {
             Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
             $dbAdapter = Zend_Registry::get('dbAdapter');
             $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
             $authAdapter->setTableName('utilisateur');
             $authAdapter->setIdentityColumn('login_utilisateur');
             $authAdapter->setCredentialColumn('pass_utilisateur');
             $authAdapter->setIdentity($username);
             $authAdapter->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $data = $authAdapter->getResultRowObject(null, 'password');
                 $auth->getStorage()->write($data);
                 $this->_redirect('/');
             }
         }
         $this->_redirect('auth/loginfail');
     }
 }
开发者ID:Zabu,项目名称:MTA,代码行数:28,代码来源:AuthController.php

示例6: indexAction

 public function indexAction()
 {
     $form = $this->_getLoginForm();
     if (!$this->getRequest()->isPost() || !$form->isValid($_POST)) {
         $this->view->loginForm = $form;
         return;
     }
     $val = $form->getValues();
     $adapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
     $adapter->setTableName('User');
     $adapter->setIdentityColumn('username');
     $adapter->setCredentialColumn('password');
     $adapter->setIdentity($val['username']);
     $adapter->setCredential(sha1($val['password']));
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($adapter);
     if ($result->isValid()) {
         // Do not store password for security purposes
         $auth->getStorage()->write($adapter->getResultRowObject(null, 'password'));
         $this->_helper->redirector('index', 'index');
     } else {
         $this->view->failed = true;
         $this->view->loginForm = $form;
     }
 }
开发者ID:Kjir,项目名称:carpond,代码行数:25,代码来源:LoginController.php

示例7: login

 public static function login($email, $password)
 {
     $db = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($db);
     $authAdapter->setTableName('users');
     $authAdapter->setIdentityColumn('email');
     $authAdapter->setCredentialColumn('password');
     $authAdapter->setCredentialTreatment('?');
     $authAdapter->setIdentity($email);
     $authAdapter->setCredential($password);
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     if ($result->isValid()) {
         $data = $authAdapter->getResultRowObject(null, 'password');
         $oUser = null;
         $tUserInfo = new Table_UsersInfo();
         $data = $tUserInfo->getUser($data->userID);
         $oUser->school_id = $data->school_id;
         $oUser->user_id = $data->user_id;
         $oUser->email = $email;
         if (is_null($oUser)) {
             return false;
         }
         $auth->getStorage()->write($oUser);
         return true;
     }
     return false;
 }
开发者ID:nldfr219,项目名称:zhi,代码行数:28,代码来源:User.php

示例8: loginAction

 function loginAction()
 {
     require_once 'login.php';
     $form = new forms_login();
     if (!$this->getRequest()->isPost()) {
         $this->view->loginForm = $form;
         return;
     }
     $values = array('username' => $_POST['username'], 'password' => $_POST['password']);
     // Setup DbTable adapter
     $adapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
     // set earlier in Bootstrap
     $adapter->setTableName('sis_users');
     $adapter->setIdentityColumn('CAUS_TX_Usuario');
     $adapter->setCredentialColumn('CAUS_TX_Senha');
     $adapter->setIdentity($values['username']);
     $adapter->setCredential($values['password']);
     // authentication attempt
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($adapter);
     // authentication succeeded
     if ($result->isValid()) {
         $data = $adapter->getResultRowObject(null, 'password');
         $auth->getStorage()->write($data);
         $_SESSION['userid'] = $data->CAUS_NM_ID;
         return $this->_redirect('system/system');
     } else {
         // or not! Back to the login page!
         $this->view->failedAuthentication = true;
         $this->view->form = $form;
     }
 }
开发者ID:Ogwang,项目名称:sainp,代码行数:32,代码来源:IndexController.php

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

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

 /**
  * index action
  */
 public function indexAction()
 {
     //body action
     $layoutPath = APPLICATION_PATH . '/templates/login';
     $option = array('layout' => 'index', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Đăng Nhập - ' . $translate->_("TEXT_DEFAULT_TITLE");
     $this->view->headTitle($this->view->title);
     $messages = array();
     if ($this->_request->isPost()) {
         $username = trim($this->getRequest()->getPost('username'));
         $password = $this->getRequest()->getPost('password');
         if (!Zend_Validate::is($username, 'NotEmpty') || !Zend_Validate::is($password, 'NotEmpty')) {
             $messages = array('text' => 'Bạn phải điền đầy đủ thông tin!', 'type' => 'errormsg');
         }
         if (!count($messages)) {
             Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
             $db = Zend_Db_Table::getDefaultAdapter();
             // create the auth adapter
             $authAdapter = new Zend_Auth_Adapter_DbTable($db);
             $authAdapter->setTableName(TABLE_USERS);
             $authAdapter->setIdentityColumn('username');
             $authAdapter->setCredentialColumn('password');
             // set username, password
             $password = md5($password);
             $username = strtolower($username);
             $authAdapter->setIdentity($username);
             $authAdapter->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 // luu tru gia tri can thiet cua user
                 $data = $authAdapter->getResultRowObject(array('user_id', 'em_id', 'group_id', 'status'));
                 if ($data->status) {
                     $logModel = new Login_Model_Logs();
                     $ip = $this->get_client_ip();
                     $data_log = array('user_id' => $data->user_id, 'login_ip' => $ip);
                     $insertLog = $logModel->insertLog($data_log);
                     $last_login_data = $logModel->getLastLogin($data->user_id);
                     if (sizeof($last_login_data)) {
                         $data->last_login_data = $last_login_data[0];
                     }
                     $auth->getStorage()->write($data);
                     $redirector = new Zend_Controller_Action_Helper_Redirector();
                     $redirector->gotoUrlAndExit(SITE_URL);
                 } else {
                     $auth->clearIdentity();
                     $messages = array('text' => 'Đăng nhập thất bại!', 'type' => 'errormsg');
                     $this->view->messages = $messages;
                 }
             } else {
                 $messages = array('text' => 'Thông tin đăng nhập không chính xác!', 'type' => 'errormsg');
                 $this->view->messages = $messages;
             }
         }
     }
 }
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:61,代码来源:IndexController.php

示例12: getAuthAdapter

 /**
  * Gets the adapter for authentication against a database table
  *
  * @return object
  */
 protected function getAuthAdapter()
 {
     $auth_adapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
     $auth_adapter->setTableName('admin_users');
     $auth_adapter->setIdentityColumn('email');
     $auth_adapter->setCredentialColumn('password');
     $auth_adapter->setCredentialTreatment('MD5(?) AND is_active=TRUE');
     return $auth_adapter;
 }
开发者ID:zelimirus,项目名称:yard,代码行数:14,代码来源:AuthController.php

示例13: loginAction

 public function loginAction()
 {
     $request = $this->getRequest();
     $user = $request->getParam('login_user');
     $password = $request->getParam('login_password');
     if ($user != '' && $password != '') {
         $password = md5($request->getParam('login_password'));
         $auth = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
         $auth->setIdentityColumn('idusergslab');
         $auth->setCredentialColumn('nmpassword');
         $auth->setTableName('usergslab');
         $auth->setIdentity($user);
         $auth->setCredential($password);
         if (!Zend_Auth::getInstance()->authenticate($auth)->isValid()) {
             // Quando usuário ou senha inválidos...
             $this->_redirect('/login/index/error/true');
         } else {
             // Se usuário e senha válidos.
             $userModel = new UserModel();
             $companyModel = new CompanyModel();
             $userData = $userModel->fetchRow($userModel->getUserByCompany($user, $request->getParam('company')));
             $companyData = $companyModel->fetchRow("cdcompany = " . $request->getParam('company'));
             if (!$userData || $userData['fgactive'] != 1 || $companyData['fgactive'] != 1) {
                 Zend_Session::destroy(true);
                 $this->_redirect('/login/index/error/lab');
                 die;
             }
             $userSess = new stdClass();
             $userSess->cdusergslab = $userData->cdusergslab;
             $userSess->cdrole = $userData->cdrole;
             $userSess->cddepartment = $userData->cddepartment;
             $userSess->cddepartmentsupervisor = $userData->cddepartmentsupervisor;
             $userSess->idusergslab = $userData->idusergslab;
             $userSess->nmusergslab = $userData->nmusergslab;
             $userSess->nmmail = $userData->nmmail;
             $userSess->idrg = $userData->idrg;
             $userSess->idcpf = $userData->idcpf;
             $userSess->nmpassword = $userData->nmpassword;
             $userSess->nmuserimage = $userData->nmuserimage;
             $userSess->nmcompanylogo = $companyData->nmcompanylogo;
             $userSess->cdcompany = $companyData->cdcompany;
             $userSess->nmcompany = $companyData->nmcompany;
             $this->setSessionData("user", null, $userSess);
             $layout = Zend_Layout::getMvcInstance();
             $view = $layout->getView();
             $view->nmuserimage = $userData->nmuserimage;
             $data = $auth->getResultRowObject(null);
             Zend_Auth::getInstance()->getStorage()->write($data);
             $identity = Zend_Auth::getInstance()->getIdentity();
             $this->_redirect('/');
         }
     } else {
         $this->_redirect($this->baseUrl);
     }
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:55,代码来源:LoginController.php

示例14: loginAction

 function loginAction()
 {
     $this->_helper->layout->disableLayout();
     Zend_Date_Cities::getCityList();
     $form = new App_Form_Login();
     $this->view->form = $form;
     $this->view->message = '';
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $filter = new Zend_Filter_StripTags();
         $username = $filter->filter($this->_request->getPost('username'));
         $password = $filter->filter($this->_request->getPost('password'));
         if (empty($username)) {
             $this->view->message = 'Please provide a username.';
         } else {
             // setup Zend_Auth adapter for a database table
             Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
             $db = Zend_Db_Table::getDefaultAdapter();
             $authAdapter = new Zend_Auth_Adapter_DbTable($db);
             $authAdapter->setTableName('ourbank_user');
             $authAdapter->setIdentityColumn('username');
             $authAdapter->setCredentialColumn('password');
             $authAdapter->setIdentity($username);
             $authAdapter->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $data = $authAdapter->getResultRowObject(null, 'password');
                 $auth->getStorage()->write($data);
                 $userinfo = new App_Model_Users();
                 $getresult = $userinfo->userinfo($username);
                 foreach ($getresult as $getdata) {
                     $user_id = $getdata["id"];
                     $username = $getdata["name"];
                 }
                 $sessionName = new Zend_Session_Namespace('ourbank');
                 $sessionName->__set('primaryuserid', $user_id);
                 $sessionName->primaryuserid;
                 $sessionName->__set('username', $username);
                 $sessionName->username;
                 $globalsession = new App_Model_Users();
                 $this->view->globalvalue = $globalsession->getSession();
                 $sessionName->__set('language', $this->view->globalvalue[1]);
                 $this->_redirect('/index/index');
             } else {
                 $this->view->message = 'Login failed.';
             }
         }
     }
     $this->view->title = "Log in";
     $this->render();
 }
开发者ID:maniargaurav,项目名称:OurBank,代码行数:52,代码来源:IndexController.php

示例15: getAuthAdapter

 public function getAuthAdapter(array $params)
 {
     $email = $params["email"];
     $password = $params["password"];
     $db = Zend_Registry::get('db');
     $authAdapter = new Zend_Auth_Adapter_DbTable($db);
     $authAdapter->setTableName('consumer');
     $authAdapter->setIdentityColumn('email');
     $authAdapter->setCredentialColumn('password');
     $authAdapter->setIdentity($email);
     $authAdapter->setCredential(md5($password));
     return $authAdapter;
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:13,代码来源:LoginController.php


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