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