本文整理汇总了PHP中AuthorPeer::retrieveByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthorPeer::retrieveByEmail方法的具体用法?PHP AuthorPeer::retrieveByEmail怎么用?PHP AuthorPeer::retrieveByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthorPeer
的用法示例。
在下文中一共展示了AuthorPeer::retrieveByEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeForgot
public function executeForgot(sfWebRequest $request)
{
$this->forward404If($this->getUser()->isAuthenticated());
$this->form = new PasswordEmailForm();
if ($request->isMethod('post') && $this->form->bindAndCheck($request->getParameter('forgot'))) {
$user = AuthorPeer::retrieveByEmail($this->form->getValue('email'));
if (!$user->getPassword()) {
$this->getUser()->setFlash('notice', 'The provided email is not a normal account with a password to recover. You probably used Sign in with Twitter.');
$this->redirect('@homepage');
}
$hash = md5(uniqid(time(), true));
$user->setCheckHash($hash);
$user->save();
$mailBody = $this->getPartial('forgotEmail', array('hash' => $hash, 'name' => $user->getFirstName()));
require_once 'lib/vendor/swift/swift_init.php';
# needed due to symfony autoloader
$mailer = Swift_Mailer::newInstance(Swift_MailTransport::newInstance());
$message = Swift_Message::newInstance('Retrieve your password')->setFrom(array(sfConfig::get('app_webmaster_email') => 'MooTools Plugins'))->setTo(array($user->getEmail() => $user->getFullname()))->setBody($mailBody, 'text/html');
$mailer->send($message);
$this->getUser()->setFlash('notice', 'An email with a confirmation link has been sent');
}
}