/**
* Send new password
*
* @param string $email Email address
*
* @return boolean
*/
public function sendForgotPasswordEmail($email)
{
$row = $this->fetchRow($this->select(array('email' => $email)));
if (!empty($row)) {
$user = self::fromArray((array) $row);
$passwordKey = sha1(uniqid());
$user->setRetrievePasswordKey($passwordKey);
$user->setRetrieveUpdatedAt(new Expression('NOW()'));
$user->save();
$serviceManager = Registry::get('Application')->getServiceManager();
$message = $serviceManager->get('MvcTranslator')->translate('To reset your password follow this link but be careful ' . 'you only have one hour before the link expires:');
$message .= '<br>';
$message .= Registry::get('Application')->getMvcEvent()->getRouter()->assemble(array('id' => $user->getId(), 'key' => $passwordKey), array('force_canonical' => true, 'name' => 'config/user/forgot-password-key'));
$mail = new Mail('utf-8', $message, $serviceManager->get('CoreConfig')->getValue('mail_from'), $user->getEmail());
$mail->send();
return true;
}
return false;
}