Redirect new customer with valid email to the registration page.
This commit is contained in:
@@ -193,6 +193,11 @@ class CustomerController extends BaseFrontController
|
|||||||
|
|
||||||
$form = $this->validateForm($customerLoginForm, "post");
|
$form = $this->validateForm($customerLoginForm, "post");
|
||||||
|
|
||||||
|
// If User is a new customer
|
||||||
|
if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
|
||||||
|
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
|
||||||
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
|
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
|
||||||
@@ -204,23 +209,17 @@ class CustomerController extends BaseFrontController
|
|||||||
$this->redirectSuccess($customerLoginForm);
|
$this->redirectSuccess($customerLoginForm);
|
||||||
|
|
||||||
} catch (UsernameNotFoundException $e) {
|
} catch (UsernameNotFoundException $e) {
|
||||||
$message = "1.Wrong email or password. Please try again";
|
$message = "Wrong email or password. Please try again";
|
||||||
} catch (WrongPasswordException $e) {
|
} catch (WrongPasswordException $e) {
|
||||||
$message = "2.Wrong email or password. Please try again";
|
$message = "Wrong email or password. Please try again";
|
||||||
} catch (AuthenticationException $e) {
|
} catch (AuthenticationException $e) {
|
||||||
$message = "3.Wrong email or password. Please try again";
|
$message = "Wrong email or password. Please try again";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (FormValidationException $e) {
|
} catch (FormValidationException $e) {
|
||||||
|
|
||||||
// If User is a new customer
|
|
||||||
$form = $customerLoginForm->getForm();
|
|
||||||
if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
|
|
||||||
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
|
|
||||||
} else {
|
|
||||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user