Esempio n. 1
0
 /**
  * Register anonymous profile
  * 
  * @return void
  */
 protected function doActionRegisterAsNew()
 {
     $result = false;
     $profile = $this->getModelForm()->getModelObject();
     if ($profile && $profile->isPersistent() && $profile->getAnonymous() && !$profile->getOrder() && !\XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findUserWithSameLogin($profile)) {
         $profile->setAnonymous(false);
         $password = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->generatePassword();
         $profile->setPassword(\XLite\Core\Auth::encryptPassword($password));
         $result = $profile->update();
     }
     if ($result) {
         // Send notification to the user
         \XLite\Core\Mailer::sendRegisterAnonymousCustomer($profile, $password);
         \XLite\Core\TopMessage::addInfo('The profile has been registered. The password has been sent to the user\'s email address');
     }
 }