Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
abolabo committed May 4, 2017
1 parent d823be3 commit d2a5c57
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions public_html/storefront/controller/pages/account/create.php
Expand Up @@ -41,7 +41,7 @@ public function main(){
if($this->csrftoken->isTokenValid()){
$this->errors = array_merge($this->errors, $this->model_account_customer->validateRegistrationData($request_data));
} else {
$this->error['warning'] = $this->language->get('error_unknown');
$this->errors['warning'] = $this->language->get('error_unknown');
}
if (!$this->errors){
//if allow login as email, need to set loginname = email
Expand All @@ -56,9 +56,9 @@ public function main(){

if (!$this->config->get('config_customer_approval')){
//add and send account activation link if required
if (!$this->config->get('config_customer_email_activation')){
if (!$this->config->get('config_customer_email_activation')){
//send welcome email
$this->model_account_customer->sendWelcomeEmail($this->request->post['email'], true);
$this->model_account_customer->sendWelcomeEmail($this->request->post['email'], true);
//login customer after create account is approving and email activation are disabled in settings
$this->customer->login($request_data['loginname'], $request_data['password']);
} else{
Expand Down Expand Up @@ -171,6 +171,9 @@ public function main(){

if ($im_drivers){
foreach ($im_drivers as $protocol => $driver_obj){
/**
* @var AMailIM $driver_obj
*/
if (!is_object($driver_obj) || $protocol=='email'){
continue;
}
Expand Down Expand Up @@ -221,8 +224,9 @@ public function main(){

$this->loadModel('localisation/country');
$countries = $this->model_localisation_country->getCountries();
$options = array();
if(count($countries) > 1) {
$options = array ("FALSE" => $this->language->get('text_select'));
$options = array ("FALSE" => $this->language->get('text_select'));
}
foreach ($countries as $item){
$options[$item['country_id']] = $item['name'];
Expand All @@ -232,7 +236,9 @@ public function main(){
'type' => 'selectbox',
'name' => 'country_id',
'options' => $options,
'value' => (isset($this->request->post['country_id']) ? $this->request->post['country_id'] : $this->config->get('config_country_id')),
'value' => (isset($this->request->post['country_id'])
? $this->request->post['country_id']
: $this->config->get('config_country_id')),
'required' => true));

$this->data['form']['fields']['password']['password'] = $form->getFieldHtml(
Expand All @@ -252,7 +258,9 @@ public function main(){
array (
'type' => 'radio',
'name' => 'newsletter',
'value' => (!is_null($this->request->get_or_post('newsletter')) ? $this->request->get_or_post('newsletter') : -1),
'value' => (!is_null($this->request->get_or_post('newsletter'))
? $this->request->get_or_post('newsletter')
: -1),
'options' => array (
'1' => $this->language->get('text_yes'),
'0' => $this->language->get('text_no'),
Expand All @@ -268,7 +276,6 @@ public function main(){
'recaptcha_site_key' => $this->config->get('config_recaptcha_site_key'),
'language_code' => $this->language->getLanguageCode()
));

} else{
$this->data['form']['fields']['newsletter']['captcha'] = $form->getFieldHtml(
array (
Expand All @@ -278,7 +285,7 @@ public function main(){
}
}

//TODO: REMOVE THIS IN 1.3!!!
//TODO: REMOVE THIS IN 2.0!!!
// backward compatibility code
$deprecated = $this->data['form']['fields'];
foreach($deprecated as $section=>$fields){
Expand All @@ -302,8 +309,9 @@ public function main(){
$this->data['form']['continue'] = $form->getFieldHtml(
array (
'type' => 'submit',
'name' => $this->language->get('button_continue')));

'name' => $this->language->get('button_continue')
)
);

$this->data['error_warning'] = $this->errors['warning'];
$this->data['error_loginname'] = $this->errors['loginname'];
Expand Down Expand Up @@ -349,21 +357,17 @@ public function main(){
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}

public function resend(){
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);

$this->loadModel('account/customer');
$enc = new AEncryption($this->config->get('encryption_key'));
$enc = new AEncryption($this->config->get('encryption_key'));
list($customer_id, $activation_code) = explode("::", $enc->decrypt($this->request->get['rid']));
if($customer_id && $activation_code) {

$this->model_account_customer->emailActivateLink($customer_id);
}

$this->extensions->hk_UpdateData($this, __FUNCTION__);
redirect($this->html->getSecureURL('account/success'));
}

}
}

0 comments on commit d2a5c57

Please sign in to comment.