本文整理汇总了PHP中UserRepository::FindByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::FindByEmail方法的具体用法?PHP UserRepository::FindByEmail怎么用?PHP UserRepository::FindByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository::FindByEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendRandomPassword
public function SendRandomPassword()
{
$emailAddress = $this->_page->GetEmailAddress();
Log::Debug('Password reset request for email address %s requested from REMOTE_ADDR: %s REMOTE_HOST: %s', $emailAddress, $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_HOST']);
$temporaryPassword = Password::GenerateRandom();
$passwordEncryption = new PasswordEncryption();
$salt = $passwordEncryption->Salt();
$encrypted = $passwordEncryption->Encrypt($temporaryPassword, $salt);
$userRepository = new UserRepository();
$user = $userRepository->FindByEmail($emailAddress);
if ($user != null) {
$user->ChangePassword($encrypted, $salt);
$userRepository->Update($user);
$emailMessage = new ForgotPasswordEmail($user, $temporaryPassword);
ServiceLocator::GetEmailService()->Send($emailMessage);
}
}