本文整理汇总了PHP中Authentication::mayVerifyEmailAgain方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::mayVerifyEmailAgain方法的具体用法?PHP Authentication::mayVerifyEmailAgain怎么用?PHP Authentication::mayVerifyEmailAgain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::mayVerifyEmailAgain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateEmailVerificationAttempt
public static function updateEmailVerificationAttempt($userID)
{
$data = self::selectFirst("SELECT email, email_lastVerificationAttempt FROM users WHERE id = " . intval($userID));
if (isset($data['email_lastVerificationAttempt']) && isset($data['email'])) {
if (Authentication::mayVerifyEmailAgain($data['email_lastVerificationAttempt'])) {
if ($data['email'] != '') {
self::update("UPDATE users SET email_lastVerificationAttempt = " . time() . " WHERE id = " . intval($userID));
return true;
}
}
}
return false;
}
示例2: getPage_Settings
public static function getPage_Settings($contents, $containers)
{
if (Authentication::getUserID() <= 0) {
self::setTitle('Settings');
$contents[] = new UI_Heading('Settings', true);
$contents[] = self::getLoginForm('Please sign in below to access your settings.');
} else {
$currentPageURL = URL::toPage('settings');
UI::addBreadcrumbItem($currentPageURL, 'Settings');
self::setTitle('Settings');
$contents[] = new UI_Heading('Settings', true);
$form = new UI_Form($currentPageURL, false);
$form->addContent(new UI_Form_StaticText('Username', htmlspecialchars(Authentication::getUserName())));
$textRealName = new UI_Form_Text('Real name', 'settings[realName]', 'Enter your name here', false, 'Let others know who you are, so that they know who is contributing to their projects.');
$textRealName->setDefaultValue(Authentication::getUserRealName());
$form->addContent($textRealName);
$selectNativeLanguage = new UI_Form_Select('Native language', 'settings[nativeLanguage][]', 'Which language is your native language? You may select multiple entries here.', true);
$userNativeLanguages = Database::getNativeLanguages(Authentication::getUserID());
$languages = Language::getList();
foreach ($languages as $languageID) {
$selectNativeLanguage->addOption(Language::getLanguageNameFull($languageID), $languageID);
}
foreach ($userNativeLanguages as $userNativeLanguage) {
$selectNativeLanguage->addDefaultOption($userNativeLanguage);
}
Time::init();
/** @var array|UI_Form_Select[] $selectTimezones */
$selectTimezones = array();
$selectCountry = new UI_Form_Select('Country', 'settings[country]', 'Choose your country of residence to control the timezone selection below.', false, '', '', 'chooseTimezoneByCountry(this.value);');
$selectCountry->addOption('— Please choose —', '');
$countries = Time::getCountries();
$defaultCountry = Authentication::getUserCountry();
$defaultTimezone = Authentication::getUserTimezone();
foreach ($countries as $countryCode => $countryName) {
$selectCountry->addOption($countryName, $countryCode);
$timezones = Time::getTimezones($countryCode);
$selectTimezones[$countryCode] = new UI_Form_Select('Timezone', 'settings[timezone][' . $countryCode . ']', 'Set your timezone here to determine how dates are displayed for you.', false, 'timezone-select timezone-select-' . $countryCode, $countryCode == $defaultCountry ? '' : 'display:none;');
foreach ($timezones as $timezoneName) {
$selectTimezones[$countryCode]->addOption($timezoneName, $timezoneName);
}
if ($countryCode == $defaultCountry) {
$selectTimezones[$countryCode]->addDefaultOption($defaultTimezone);
}
}
$selectCountry->addDefaultOption($defaultCountry);
$form->addContent($selectNativeLanguage);
$form->addContent($selectCountry);
foreach ($selectTimezones as $selectTimezone) {
$form->addContent($selectTimezone);
}
// EMAIL ADDRESS FIELD BEGIN
$emailVerificationStatus = Authentication::getUserEmail_lastVerificationAttempt() == 0 ? '' : '<span style="color:#f00;">Unverified:</span> ';
if (Authentication::mayChangeEmailAgain(Authentication::getUserEmail_lastVerificationAttempt())) {
$emailReadonly = false;
if (Authentication::mayVerifyEmailAgain(Authentication::getUserEmail_lastVerificationAttempt())) {
$resendVerificationLink = new UI_Link('You may re-send the verification link.', URL::toSettingsAction('resendVerificationEmail'));
$emailHelpText = 'Enter your personal email address here, optionally. ' . $resendVerificationLink->getHTML();
} else {
$emailHelpText = 'Enter your personal email address here, optionally. Please make sure that it is up-to-date.';
}
} else {
$emailReadonly = true;
if (Authentication::mayVerifyEmailAgain(Authentication::getUserEmail_lastVerificationAttempt())) {
$resendVerificationLink = new UI_Link('You may re-send the verification link.', URL::toSettingsAction('resendVerificationEmail'));
$emailHelpText = 'You cannot change your email address again, yet. ' . $resendVerificationLink->getHTML();
} else {
$emailHelpText = 'You cannot change your email address again, yet. Please visit this page later.';
}
}
$textEmail = new UI_Form_Text('Email address', 'settings[email]', 'Enter your email address here', false, $emailVerificationStatus . $emailHelpText);
$textEmail->setReadOnly($emailReadonly);
$textEmail->setDefaultValue(Authentication::getUserEmail());
$form->addContent($textEmail);
// EMAIL ADDRESS FIELD END
$form->addContent(new UI_Form_ButtonGroup(array(new UI_Form_Button('Save'), new UI_Link('Cancel', URL::toDashboard(), UI_Link::TYPE_UNIMPORTANT))));
$contents[] = $form;
}
$cell = new UI_Cell($contents);
$row = new UI_Row(array($cell));
$containers[] = new UI_Container(array($row));
return new UI_Group($containers);
}