Skip to content

Commit

Permalink
// Fix ajax create account
Browse files Browse the repository at this point in the history
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10631 b9a71923-0436-4b27-9f14-aed3839534dd
  • Loading branch information
rGaillard committed Nov 23, 2011
1 parent c3e7c28 commit ffc24ed
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions controllers/front/AuthController.php
Expand Up @@ -123,6 +123,23 @@ public function initContent()
'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('createAccountForm'),
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('createAccountTop')
));

if ($this->ajax)
{
// Call a hook to display more information on form
$this->context->smarty->assign(array(
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'genders' => Gender::getGenders()
));

$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'page' => $this->context->smarty->fetch(_PS_THEME_DIR_.'authentication.tpl'),
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
}

Expand Down Expand Up @@ -573,24 +590,6 @@ protected function processSubmitCreate()
$this->context->smarty->assign('email_create', Tools::safeOutput($email));
$_POST['email'] = $email;
}
if ($this->ajax)
{
// Call a hook to display more information on form
$this->context->smarty->assign(array(
'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('createAccountForm'),
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('createAccountTop'),
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'genders' => Gender::getGenders()
));

$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'page' => $this->context->smarty->fetch(_PS_THEME_DIR_.'authentication.tpl'),
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
}

/**
Expand Down

0 comments on commit ffc24ed

Please sign in to comment.