當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authenticate::getEmployeeByPassword方法代碼示例

本文整理匯總了PHP中Authenticate::getEmployeeByPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticate::getEmployeeByPassword方法的具體用法?PHP Authenticate::getEmployeeByPassword怎麽用?PHP Authenticate::getEmployeeByPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authenticate的用法示例。


在下文中一共展示了Authenticate::getEmployeeByPassword方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preprocess

 function preprocess()
 {
     $this->box_color = "coloredArea";
     $this->msg = _("enter admin password");
     // get calling class (required)
     $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
     $pos_home = MiscLib::base_url() . 'gui-modules/pos2.php';
     if ($class === '' || !class_exists($class)) {
         $this->change_page($pos_home);
         return False;
     }
     // make sure calling class implements required
     // method and properties
     try {
         $method = new ReflectionMethod($class, 'adminLoginCallback');
         if (!$method->isStatic() || !$method->isPublic()) {
             throw new Exception('bad method adminLoginCallback');
         }
         $property = new ReflectionProperty($class, 'adminLoginMsg');
         if (!$property->isStatic() || !$property->isPublic()) {
             throw new Exception('bad property adminLoginMsg');
         }
         $property = new ReflectionProperty($class, 'adminLoginLevel');
         if (!$property->isStatic() || !$property->isPublic()) {
             throw new Exception('bad property adminLoginLevel');
         }
     } catch (Exception $e) {
         $this->change_page($pos_home);
         return False;
     }
     $this->heading = $class::$adminLoginMsg;
     if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) {
         $passwd = '';
         if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) {
             $passwd = $_REQUEST['reginput'];
         } else {
             if (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) {
                 $passwd = $_REQUEST['userPassword'];
             }
         }
         if (strtoupper($passwd) == "CL") {
             $class::adminLoginCallback(False);
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         } else {
             if (empty($passwd)) {
                 $this->box_color = "errorColoredArea";
                 $this->msg = _("re-enter admin password");
             } else {
                 $db = Database::pDataConnect();
                 if (Authenticate::checkPermission($passwd, $class::$adminLoginLevel)) {
                     $row = Authenticate::getEmployeeByPassword($passwd);
                     TransRecord::add_log_record(array('upc' => $row['emp_no'], 'description' => substr($class::$adminLoginMsg . ' ' . $row['FirstName'], 0, 30), 'charflag' => 'PW', 'num_flag' => $row['emp_no']));
                     if (CoreLocal::get('LoudLogins') == 1) {
                         UdpComm::udpSend('twoPairs');
                     }
                     $result = $class::adminLoginCallback(True);
                     if ($result === True) {
                         $this->change_page(MiscLib::base_url() . 'gui-modules/pos2.php');
                     } else {
                         $this->change_page($result);
                     }
                     return False;
                 } else {
                     $this->box_color = "errorColoredArea";
                     $this->msg = _("re-enter admin password");
                     TransRecord::add_log_record(array('upc' => $passwd, 'description' => substr($class::$adminLoginMsg, 0, 30), 'charflag' => 'PW'));
                     if (CoreLocal::get('LoudLogins') == 1) {
                         UdpComm::udpSend('errorBeep');
                     }
                 }
             }
         }
     } else {
         // beep on initial page load
         if (CoreLocal::get('LoudLogins') == 1) {
             UdpComm::udpSend('twoPairs');
         }
     }
     return True;
 }
開發者ID:phpsmith,項目名稱:IS4C,代碼行數:81,代碼來源:adminlogin.php

示例2: testAuthenticate

 public function testAuthenticate()
 {
     CoreLocal::set('scaleDriver', '');
     // don't interact w/ scale
     Database::setglobalvalue('LoggedIn', 1);
     Database::setglobalvalue('CashierNo', 1);
     $fail = Authenticate::checkPassword('9999');
     $this->assertEquals(False, $fail);
     Database::setglobalvalue('CashierNo', 9999);
     $pass = Authenticate::checkPassword('9999');
     $this->assertEquals(True, $pass);
     Database::setglobalvalue('LoggedIn', 0);
     Database::setglobalvalue('CashierNo', 1);
     $pass = Authenticate::checkPassword('9999');
     $this->assertEquals(True, $pass);
     Database::setglobalvalue('LoggedIn', 0);
     Database::setglobalvalue('CashierNo', 1);
     $pass = Authenticate::checkPassword('56');
     $this->assertEquals(True, $pass);
     Database::setglobalvalue('LoggedIn', 0);
     Database::setglobalvalue('CashierNo', 1);
     $fail = Authenticate::checkPassword('invalid password');
     $this->assertEquals(false, $fail);
     $this->assertEquals(false, Authenticate::checkPermission('56', 50));
     $this->assertEquals(false, Authenticate::checkPermission('56', 21));
     $this->assertEquals(true, Authenticate::checkPermission('56', 20));
     $this->assertEquals(true, Authenticate::checkPermission('56', 10));
     $this->assertEquals(false, Authenticate::getEmployeeByPassword('asdf'));
     $this->assertInternalType('array', Authenticate::getEmployeeByPassword('56'));
     $this->assertEquals(false, Authenticate::getEmployeeByNumber(75));
     $this->assertInternalType('array', Authenticate::getEmployeeByNumber(56));
     $this->assertEquals(0, Authenticate::getPermission(55));
     $this->assertEquals(20, Authenticate::getPermission(56));
 }
開發者ID:phpsmith,項目名稱:IS4C,代碼行數:34,代碼來源:BaseLibsTest.php


注:本文中的Authenticate::getEmployeeByPassword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。