public function createPassword(AdministratorEvent $event)
 {
     $admin = $event->getAdministrator();
     $email = $admin->getEmail();
     if (!empty($email)) {
         $renewToken = $this->tokenProvider->getToken();
         $admin->setPasswordRenewToken($renewToken)->save();
         $this->mailer->sendEmailMessage('new_admin_password', [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], [$email => $admin->getFirstname() . ' ' . $admin->getLastname()], ['token' => $renewToken, 'admin' => $admin]);
     }
 }
Beispiel #2
0
 /**
  * Generate the cart cookie identifier, or return null if the cart is only managed in the session object,
  * not in a client cookie.
  *
  * @return string
  */
 protected function generateCartCookieIdentifier()
 {
     $id = null;
     if (ConfigQuery::read("cart.use_persistent_cookie", 1) == 1) {
         $id = $this->tokenProvider->getToken();
         $this->session->set('cart_use_cookie', $id);
     }
     return $id;
 }
 public function generateUrlWithToken($params, &$smarty)
 {
     /**
      * Compute the url
      */
     $url = $this->generateUrlFunction($params, $smarty);
     $urlTokenParam = $this->getParam($params, "url_param", "_token");
     /**
      * Add the token
      */
     $token = $this->tokenProvider->assignToken();
     $newUrl = URL::getInstance()->absoluteUrl($url, [$urlTokenParam => $token]);
     return $this->applyNoAmpAndTarget($params, $newUrl);
 }
Beispiel #4
0
 protected function manageSecret(Database $database)
 {
     $secret = TokenProvider::generateToken();
     $sql = "UPDATE `config` SET `value`=? WHERE `name`='form.secret'";
     $database->execute($sql, [$secret]);
 }
Beispiel #5
0
 }
 if ($_SESSION['install']['step'] == 5) {
     // Check now if we can create the App.
     $thelia = new \Thelia\Core\Thelia("install", true);
     $thelia->boot();
     $admin = new \Thelia\Model\Admin();
     $admin->setLogin($_POST['admin_login'])->setPassword($_POST['admin_password'])->setFirstname('admin')->setLastname('admin')->setLocale(empty($_POST['admin_locale']) ? 'en_US' : $_POST['admin_locale'])->setLocale($_POST['admin_email'])->save();
     \Thelia\Model\ConfigQuery::create()->filterByName('store_email')->update(array('Value' => $_POST['store_email']));
     \Thelia\Model\ConfigQuery::create()->filterByName('store_notification_emails')->update(array('Value' => $_POST['store_email']));
     \Thelia\Model\ConfigQuery::create()->filterByName('store_name')->update(array('Value' => $_POST['store_name']));
     \Thelia\Model\ConfigQuery::create()->filterByName('url_site')->update(array('Value' => $_POST['url_site']));
     $lang = \Thelia\Model\LangQuery::create()->findOneByLocale(empty($_POST['shop_locale']) ? "en_US" : $_POST['shop_locale']);
     if (null !== $lang) {
         $lang->toggleDefault();
     }
     $secret = \Thelia\Tools\TokenProvider::generateToken();
     \Thelia\Model\ConfigQuery::write('form.secret', $secret, 0, 0);
 }
 //clean up cache directories
 $fs = new \Symfony\Component\Filesystem\Filesystem();
 $fs->remove(THELIA_ROOT . '/cache/prod');
 $fs->remove(THELIA_ROOT . '/cache/dev');
 $fs->remove(THELIA_ROOT . '/cache/install');
 $request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
 $_SESSION['install']['step'] = $step;
 // Retrieve the website url
 $url = $_SERVER['PHP_SELF'];
 $website_url = preg_replace("#/install/[a-z](.*)#", '', $url);
 ?>
 <div class="well">
     <p class="lead text-center">