本文整理匯總了PHP中PasswordHash::generateHint方法的典型用法代碼示例。如果您正苦於以下問題:PHP PasswordHash::generateHint方法的具體用法?PHP PasswordHash::generateHint怎麽用?PHP PasswordHash::generateHint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PasswordHash
的用法示例。
在下文中一共展示了PasswordHash::generateHint方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendResetMail
public static function sendResetMail($oUser, $bShowUserName = false, $sLinkBase = null, $bForceReset = false)
{
UserPeer::ignoreRights(true);
$oUser->setPasswordRecoverHint(PasswordHash::generateHint());
$oUser->save();
$oEmailTemplate = new Template('e_mail_pw_recover', array(DIRNAME_TEMPLATES, 'login'));
$oEmailTemplate->replaceIdentifier('full_name', $oUser->getFullName());
$oEmailTemplate->replaceIdentifier('first_name', $oUser->getFirstName());
$oEmailTemplate->replaceIdentifier('last_name', $oUser->getLastName());
$oEmailTemplate->replaceIdentifier('username', $oUser->getUsername());
if ($bShowUserName) {
$oEmailTemplate->replaceIdentifier('username_info', TranslationPeer::getString('wns.login.password_reset.your_username') . ': ' . $oUser->getUsername());
}
$sInfoTextKey = 'wns.login.password_recover_email_text2';
if ($bForceReset) {
$sInfoTextKey = 'wns.login.password_recover_email_text2_force';
}
$oEmailTemplate->replaceIdentifier('ignore_or_reset_info', TranslationPeer::getString($sInfoTextKey));
if ($sLinkBase === null) {
if (Manager::$CURRENT_MANAGER instanceof FrontendManager) {
// We’re most likely on a login page: link to self should be ok
$sLinkBase = LinkUtil::linkToSelf(null, null, true);
} else {
// Use the login manager
$sLinkBase = LinkUtil::link(array(), 'LoginManager');
}
}
$aParams = array('recover_hint' => md5($oUser->getPasswordRecoverHint()), 'recover_username' => $oUser->getUsername());
if (Session::getSession()->hasAttribute('login_referrer')) {
$aParams['recover_referrer'] = Session::getSession()->getAttribute('login_referrer');
}
$sLink = "http://" . $_SERVER['HTTP_HOST'] . $sLinkBase . LinkUtil::prepareLinkParameters($aParams);
$oEmailTemplate->replaceIdentifier('new_pw_url', $sLink);
$oEmail = new EMail(TranslationPeer::getString('wns.login.password_recover_email_subject'), $oEmailTemplate);
$sSenderAddress = LinkUtil::getDomainHolderEmail('cms');
$oEmail->setSender(Settings::getSetting('domain_holder', 'name', 'rapila on ' . $_SERVER['HTTP_HOST']), $sSenderAddress);
$oEmail->addRecipient($oUser->getEmail(), $oUser->getFullName());
$oEmail->send();
}