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


PHP Zend_Auth_Adapter_DbTable::setIdentityColumn方法代码示例

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


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

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

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

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

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

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

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

 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

示例11: indexAction

 public function indexAction()
 {
     $storage = new Zend_Auth_Storage_Session('admin_type');
     $data = $storage->read();
     if ($data && $data != null) {
         $this->_redirect('admin/');
     }
     $this->view->messages = $this->_flashMessenger->getMessages();
     //$this->_helper->layout()->disableLayout();
     $this->_helper->layout()->setLayout('adminlogin');
     $users = new Admin_Model_DbTable_AdminUsers();
     if ($this->getRequest()->isPost()) {
         $formdata = $this->getRequest()->getPost();
         $enc_pwd = md5($formdata['user_password']);
         //print_r($formdata);exit;
         $auth = Zend_Auth::getInstance();
         $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), TBL_ADMIN);
         $authAdapter->setIdentityColumn('user_name')->setCredentialColumn('user_password');
         $authAdapter->setIdentity($formdata['user_name'])->setCredential($enc_pwd);
         $result = $auth->authenticate($authAdapter);
         if ($result->isValid()) {
             $storage = new Zend_Auth_Storage_Session('admin_type');
             $storage->write($authAdapter->getResultRowObject());
             $this->_redirect('admin/');
         } else {
             $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
         }
     }
 }
开发者ID:vmangla,项目名称:evendor,代码行数:29,代码来源:AuthController.php

示例12: loginAction

 public function loginAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $storage = new Zend_Auth_Storage_Session();
         $storage->clear();
     }
     $users = new Application_Model_User();
     $form = new Application_Form_Login();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $auth = Zend_Auth::getInstance();
             $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), 'user');
             $authAdapter->setIdentityColumn('name')->setCredentialColumn('password');
             $authAdapter->setIdentity($data['name'])->setCredential($data['password']);
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $storage = new Zend_Auth_Storage_Session();
                 $storage->write($authAdapter->getResultRowObject(array('id', 'name', 'image')));
                 if ($auth->getIdentity()->name == 'admin') {
                     $this->redirect("Order/adminhome");
                 } elseif ($auth->getIdentity()->name != 'admin') {
                     $this->redirect("Order/adduserorder");
                 }
             } else {
                 $this->view->errorMessage = "Invalid username or password. Please try again.";
             }
         }
     }
 }
开发者ID:nguyenkiet,项目名称:cafeteria,代码行数:32,代码来源:AuthController.php

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

示例14: indexAction

 public function indexAction()
 {
     if (!empty($this->sessUserInfo)) {
         $this->_redirect('user/');
     }
     //$this->_helper->layout()->setLayout('publisherlogin');
     $this->view->messages = $this->_flashMessenger->getMessages();
     $formData = array();
     $formErrors = array();
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         //print_r($formData);exit;
         if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
             $formErrors['user_name'] = "Please enter your username";
         }
         if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
             $formErrors['user_password'] = "Please enter your password";
         }
         if (count($formErrors) == 0) {
             //echo md5($formData['user_password']);
             $user_pwd = md5($formData['user_password']);
             $auth = Zend_Auth::getInstance();
             $authAdapter = new Zend_Auth_Adapter_DbTable($this->modelCompanies->getAdapter(), TBL_COMPANIES);
             $authAdapter->setIdentityColumn('user_email')->setCredentialColumn('user_password');
             $authAdapter->setIdentity($formData['user_name'])->setCredential($user_pwd);
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $userInfo = $authAdapter->getResultRowObject();
                 if ($userInfo->account_type == '2' || $userInfo->account_type == '3') {
                     //AND parent_id=0
                     if ($this->modelCompanies->isExist('status=1  and id=' . $userInfo->id)) {
                         $storage = new Zend_Auth_Storage_Session('account_type');
                         $storage->write($userInfo);
                         $this->_redirect('user/');
                     } else {
                         if ($this->modelCompanies->isExist('status=1 AND parent_id>0 and id=' . $userInfo->id)) {
                             $this->view->errorMessage = '<div class="div-error">You can only login through mobile app.</div>';
                         } else {
                             $this->view->errorMessage = '<div class="div-error">Sorry, user is not active</div>';
                         }
                     }
                 } else {
                     $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
                 }
             } else {
                 $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
             }
         } else {
             $this->view->errorMessage = '<div class="div-error">Please enter username and password</div>';
         }
     }
     $sessionMsg = new Zend_Session_Namespace('step1Msg');
     $sessionMsg->formData = $formData;
     $sessionMsg->formErrors = $formErrors;
     $sessionMsg->errorMessage = $this->view->errorMessage;
     //$this->_redirect('/');
 }
开发者ID:vmangla,项目名称:evendor,代码行数:57,代码来源:AuthController.php

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


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