complete login form

This commit is contained in:
Manuel Raynaud
2013-09-10 12:16:19 +02:00
parent 71928ec879
commit 7eb3ec41fe
14 changed files with 101 additions and 32 deletions

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());