Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By Manuel Raynaud (9) and Etienne Roudeix (1)
# Via Manuel Raynaud
* 'master' of https://github.com/thelia/thelia:
  update customer loop in template customer
  strat regiter page
  complete login form
  change link for homepage
  start creating register and login pages
  display good currency in template
  defin currency at runtime
  creating index page
  fix tests
  start integration default template
This commit is contained in:
gmorel
2013-09-10 15:41:59 +02:00
192 changed files with 17914 additions and 225 deletions

View File

@@ -179,7 +179,14 @@ class BaseController extends ContainerAware
return $form;
}
else {
throw new FormValidationException(sprintf("Missing or invalid data: %s", $this->getErrorMessages($form)));
$errorMessage = null;
if ($form->get("error_message")->getData() != null) {
$errorMessage = $form->get("error_message")->getData();
} else {
$errorMessage = sprintf("Missing or invalid data: %s", $this->getErrorMessages($form));
}
throw new FormValidationException($errorMessage);
}
}
else {

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/
namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController;
use Thelia\Tools\URL;
@@ -34,8 +35,8 @@ class BaseFrontController extends BaseController
*
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
*/
protected function getRoute($routeId) {
return $this->getRouteFromRouter('router.front', $routeId);
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
return $this->getRouteFromRouter('router.front', $routeId, $parameters, $referenceType);
}
/**
@@ -44,7 +45,7 @@ class BaseFrontController extends BaseController
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
*/
public function redirectToRoute($routeId, $urlParameters = array()) {
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters));
public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH) {
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
}
}

View File

@@ -39,6 +39,7 @@ use Thelia\Core\Factory\ActionEventFactory;
use Thelia\Tools\URL;
use Thelia\Log\Tlog;
use Thelia\Core\Security\Exception\WrongPasswordException;
use Symfony\Component\Routing\Router;
/**
* Class CustomerController
@@ -167,16 +168,25 @@ class CustomerController extends BaseFrontController
}
catch (FormValidationException $e) {
if ($request->request->has("account")) {
$account = $request->request->get("account");
$form = $customerLoginForm->getForm();
if($account == 0 && $form->get("email")->getData() !== null) {
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
}
}
$message = sprintf("Please check your input: %s", $e->getMessage());
}
catch(UsernameNotFoundException $e) {
$message = "This customer email was not found.";
$message = "Wrong email or password. Please try again";
}
catch (WrongPasswordException $e) {
$message = "Wrong password. Please try again.";
$message = "Wrong email or password. Please try again";
}
catch(AuthenticationException $e) {
$message = "Sorry, we failed to authentify you. Please try again.";
$message = "Wrong email or password. Please try again";
}
catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());