From 5dc33aec4d80a1a7bab17b7c9f43ae63688da7b9 Mon Sep 17 00:00:00 2001 From: touffies Date: Tue, 22 Oct 2013 23:45:56 +0200 Subject: [PATCH 1/3] Remove duplicate class "panel" --- templates/default/account-password.html | 2 +- templates/default/account-update.html | 2 +- templates/default/contact.html | 2 +- templates/default/register.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/default/account-password.html b/templates/default/account-password.html index 40d471acc..a60a2f72a 100644 --- a/templates/default/account-password.html +++ b/templates/default/account-password.html @@ -33,7 +33,7 @@ {if $form_error}
{$form_error_message}
{/if} -
+
{intl l="Login Information"}
diff --git a/templates/default/account-update.html b/templates/default/account-update.html index 7488e9b31..6fb50162e 100644 --- a/templates/default/account-update.html +++ b/templates/default/account-update.html @@ -30,7 +30,7 @@ {if $form_error}
{$form_error_message}
{/if} -
+
{intl l="Personal Informations"}
diff --git a/templates/default/contact.html b/templates/default/contact.html index 8d5d4d89e..36b2707a8 100644 --- a/templates/default/contact.html +++ b/templates/default/contact.html @@ -18,7 +18,7 @@ {form name="thelia.front.contact"}
{form_hidden_fields form=$form} -
+
{intl l="Send us a message"}
diff --git a/templates/default/register.html b/templates/default/register.html index 919473493..82c93e4ea 100644 --- a/templates/default/register.html +++ b/templates/default/register.html @@ -25,7 +25,7 @@ {/form_field} {form_hidden_fields form=$form} {if $form_error}
{$form_error_message}
{/if} -
+
1. {intl l="Personal Informations"}
From a91303a27ddc4298aaefcd301192c61bd0dff5e8 Mon Sep 17 00:00:00 2001 From: touffies Date: Wed, 23 Oct 2013 00:07:27 +0200 Subject: [PATCH 2/3] Add new method updatePasswordAction (Not finished) --- .../Thelia/Config/Resources/routing/front.xml | 2 +- .../Controller/Front/CustomerController.php | 40 +++++++++++++++++++ core/lib/Thelia/Form/CustomerLogin.php | 2 - .../Form/CustomerPasswordUpdateForm.php | 5 +-- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index cf8ea636e..97ddce393 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -76,7 +76,7 @@ - Thelia\Controller\Front\CustomerController::newPasswordAction + Thelia\Controller\Front\CustomerController::updatePasswordAction account-password diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 9c43edce1..fa5a9e3a3 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -31,6 +31,7 @@ use Thelia\Core\Security\Exception\UsernameNotFoundException; use Thelia\Form\CustomerCreateForm; use Thelia\Form\CustomerLogin; use Thelia\Form\CustomerLostPasswordForm; +use Thelia\Form\CustomerPasswordUpdateForm; use Thelia\Form\CustomerUpdateForm; use Thelia\Form\Exception\FormValidationException; use Thelia\Model\Customer; @@ -49,6 +50,7 @@ class CustomerController extends BaseFrontController { use \Thelia\Cart\CartTrait; + public function newPasswordAction() { if (! $this->getSecurityContext()->hasCustomerUser()) { @@ -158,6 +160,44 @@ class CustomerController extends BaseFrontController $this->getParserContext()->addForm($customerUpdateForm); } + + public function updatePasswordAction() + { + if ($this->getSecurityContext()->hasCustomerUser()) { + $message = false; + + $customerPasswordUpdateForm = new CustomerPasswordUpdateForm($this->getRequest()); + + try { + $customer = $this->getSecurityContext()->getCustomerUser(); + + $form = $this->validateForm($customerPasswordUpdateForm, "post"); + + $customerChangeEvent = $this->createEventInstance($form->getData()); + $customerChangeEvent->setCustomer($customer); + //$this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent); + + $this->redirectSuccess($customerPasswordUpdateForm); + + } catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $e->getMessage()); + } catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + } + + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer password modification process : %s.", $message)); + + $customerPasswordUpdateForm->setErrorMessage($message); + + $this->getParserContext() + ->addForm($customerPasswordUpdateForm) + ->setGeneralError($message) + ; + } + } + } + public function updateAction() { if ($this->getSecurityContext()->hasCustomerUser()) { diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php index 055c0bc29..66b5c34ef 100755 --- a/core/lib/Thelia/Form/CustomerLogin.php +++ b/core/lib/Thelia/Form/CustomerLogin.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; -use Symfony\Component\Form\FormInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Email; diff --git a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php index b8310d697..78e1218ff 100755 --- a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php @@ -25,7 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\ConfigQuery; -use Thelia\Model\CustomerQuery; use Thelia\Core\Translation\Translator; /** @@ -80,7 +79,7 @@ class CustomerPasswordUpdateForm extends BaseForm public function verifyCurrentPasswordField($value, ExecutionContextInterface $context) { - + // Check current password } public function verifyPasswordField($value, ExecutionContextInterface $context) @@ -88,7 +87,7 @@ class CustomerPasswordUpdateForm extends BaseForm $data = $context->getRoot()->getData(); if ($data["password"] != $data["password_confirm"]) { - $context->addViolation("password confirmation is not the same as password field."); + $context->addViolation("Password confirmation is not the same as password field."); } } From b6f96245442acf032319ea6fd16b452f69d8ea83 Mon Sep 17 00:00:00 2001 From: touffies Date: Wed, 23 Oct 2013 11:49:36 +0200 Subject: [PATCH 3/3] Add a generic route (default) to manage the simple path --- .../Thelia/Config/Resources/routing/front.xml | 70 ++++--------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index 97ddce393..3531487ce 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -4,66 +4,37 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + - - - Thelia\Controller\Front\DefaultController::noAction - search - - - - Thelia\Controller\Front\DefaultController::noAction - view_all - - - + Thelia\Controller\Front\CustomerController::createAction register - - Thelia\Controller\Front\DefaultController::noAction - register - - - + Thelia\Controller\Front\CustomerController::loginAction login - - Thelia\Controller\Front\DefaultController::noAction - login - - + Thelia\Controller\Front\CustomerController::newPasswordAction password - - Thelia\Controller\Front\DefaultController::noAction - password - - - + Thelia\Controller\Front\CustomerController::logoutAction - - - Thelia\Controller\Front\DefaultController::noAction - account - - + Thelia\Controller\Front\CustomerController::viewAction account-update @@ -84,7 +55,6 @@ Thelia\Controller\Front\DefaultController::noAction account-password - @@ -122,11 +92,6 @@ - - Thelia\Controller\Front\DefaultController::noAction - cart - - Thelia\Controller\Front\CartController::addItem @@ -140,7 +105,6 @@ Thelia\Controller\Front\CartController::changeItem cart - @@ -179,11 +143,6 @@ - - Thelia\Controller\Front\DefaultController::noAction - contact - - Thelia\Controller\Front\ContactController::sendAction contact @@ -196,16 +155,17 @@ - - - Thelia\Controller\Front\DefaultController::noAction - newsletter - - Thelia\Controller\Front\NewsletterController::subscribeAction newsletter - + + + + Thelia\Controller\Front\DefaultController::noAction + index + ^(?!admin)[^/]+ + +