// fix problem about guest customer and default group id and the password display in the form (BO)
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11767 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -195,11 +195,12 @@ class CustomerCore extends ObjectModel
|
||||
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
||||
$this->secure_key = md5(uniqid(rand(), true));
|
||||
$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
|
||||
if (empty($this->id_default_group))
|
||||
|
||||
if ($this->id_default_group == _PS_DEFAULT_CUSTOMER_GROUP_)
|
||||
if ($this->is_guest)
|
||||
$this->id_default_group = 2;
|
||||
$this->id_default_group = Configuration::get('PS_GUEST_GROUP');
|
||||
else
|
||||
$this->id_default_group = 3;
|
||||
$this->id_default_group = Configuration::get('PS_CUSTOMER_GROUP');
|
||||
|
||||
/* Can't create a guest customer, if this feature is disabled */
|
||||
if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
|
||||
@@ -638,7 +639,7 @@ class CustomerCore extends ObjectModel
|
||||
$this->is_guest = 0;
|
||||
$this->passwd = Tools::encrypt($password);
|
||||
$this->cleanGroups();
|
||||
$this->addGroups(array(3)); // add default customer group
|
||||
$this->addGroups(array(Configuration::get('PS_CUSTOMER_GROUP'))); // add default customer group
|
||||
if ($this->update())
|
||||
{
|
||||
$vars = array(
|
||||
|
||||
@@ -361,6 +361,15 @@ class AdminCustomersControllerCore extends AdminController
|
||||
)
|
||||
);
|
||||
|
||||
// if customer is a guest customer, password hasn't to be there
|
||||
if ($obj->id && ($obj->is_guest && $obj->id_default_group == Configuration::get('PS_GUEST_GROUP')))
|
||||
{
|
||||
foreach ($this->fields_form['input'] as $k => $field)
|
||||
if ($field['type'] == 'password')
|
||||
array_splice($this->fields_form['input'], $k, 1);
|
||||
}
|
||||
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
|
||||
@@ -396,7 +396,7 @@ class AuthControllerCore extends FrontController
|
||||
if (!$customer->is_guest)
|
||||
{
|
||||
$customer->cleanGroups();
|
||||
// we add the guest customer in the default customer group
|
||||
// we add the customer in the default customer group
|
||||
$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
|
||||
if (!$this->sendConfirmationMail($customer))
|
||||
$this->errors[] = Tools::displayError('Cannot send email');
|
||||
|
||||
Reference in New Issue
Block a user