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


PHP MemberModel::findActiveByEmailAndUsername方法代碼示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $GLOBALS['TL_LANGUAGE'] = $objPage->language;
     \System::loadLanguageFile('tl_member');
     $this->loadDataContainer('tl_member');
     // Set new password
     if (strlen(\Input::get('token'))) {
         $this->setNewPassword();
         return;
     }
     // Username widget
     if (!$this->reg_skipName) {
         $arrFields['username'] = $GLOBALS['TL_DCA']['tl_member']['fields']['username'];
         $arrFields['username']['name'] = 'username';
     }
     // E-mail widget
     $arrFields['email'] = $GLOBALS['TL_DCA']['tl_member']['fields']['email'];
     $arrFields['email']['name'] = 'email';
     // Captcha widget
     if (!$this->disableCaptcha) {
         $arrFields['captcha'] = array('name' => 'lost_password', 'label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'], 'inputType' => 'captcha', 'eval' => array('mandatory' => true));
     }
     $row = 0;
     $strFields = '';
     $doNotSubmit = false;
     // Initialize the widgets
     foreach ($arrFields as $arrField) {
         $strClass = $GLOBALS['TL_FFL'][$arrField['inputType']];
         // Continue if the class is not defined
         if (!class_exists($strClass)) {
             continue;
         }
         $arrField['eval']['tableless'] = $this->tableless;
         $arrField['eval']['required'] = $arrField['eval']['mandatory'];
         $objWidget = new $strClass($strClass::getAttributesFromDca($arrField, $arrField['name']));
         $objWidget->storeValues = true;
         $objWidget->rowClass = 'row_' . $row . ($row == 0 ? ' row_first' : '') . ($row % 2 == 0 ? ' even' : ' odd');
         ++$row;
         // Validate the widget
         if (\Input::post('FORM_SUBMIT') == 'tl_lost_password') {
             $objWidget->validate();
             if ($objWidget->hasErrors()) {
                 $doNotSubmit = true;
             }
         }
         $strFields .= $objWidget->parse();
     }
     $this->Template->fields = $strFields;
     $this->Template->hasError = $doNotSubmit;
     // Look for an account and send the password link
     if (\Input::post('FORM_SUBMIT') == 'tl_lost_password' && !$doNotSubmit) {
         if ($this->reg_skipName) {
             $objMember = \MemberModel::findActiveByEmailAndUsername(\Input::post('email', true), null);
         } else {
             $objMember = \MemberModel::findActiveByEmailAndUsername(\Input::post('email', true), \Input::post('username'));
         }
         if ($objMember === null) {
             sleep(2);
             // Wait 2 seconds while brute forcing :)
             $this->Template->error = $GLOBALS['TL_LANG']['MSC']['accountNotFound'];
         } else {
             $this->sendPasswordLink($objMember);
         }
     }
     $this->Template->formId = 'tl_lost_password';
     $this->Template->username = specialchars($GLOBALS['TL_LANG']['MSC']['username']);
     $this->Template->email = specialchars($GLOBALS['TL_LANG']['MSC']['emailAddress']);
     $this->Template->action = \Environment::get('indexFreeRequest');
     $this->Template->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['requestPassword']);
     $this->Template->rowLast = 'row_' . count($arrFields) . ' row_last' . ($row % 2 == 0 ? ' even' : ' odd');
     $this->Template->tableless = $this->tableless;
 }
開發者ID:iCodr8,項目名稱:core,代碼行數:76,代碼來源:ModulePassword.php


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