本文整理汇总了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;
}