Esempio n. 1
0
 /**
  * Send create profile notifications
  *
  * @param string $password Password
  *
  * @return void
  */
 protected function sendCreateProfileNotifications($password)
 {
     $profile = $this->getCart()->getOrigProfile();
     // Send notification to the user
     \XLite\Core\Mailer::sendProfileCreatedUserNotification($profile, $password);
     // Send notification to the users department
     \XLite\Core\Mailer::sendProfileCreatedAdminNotification($profile);
 }
Esempio n. 2
0
 /**
  * testSendProfileCreatedUserNotification
  *
  * @return void
  * @access public
  * @see    ____func_see____
  * @since  1.0.0
  */
 public function testSendProfileCreatedUserNotification()
 {
     $profile = self::$admin_profile;
     $this->startCheckingMail();
     \XLite\Core\Mailer::sendProfileCreatedUserNotification($profile);
     sleep(3);
     $emails = $this->finishCheckingMail();
     if (empty($emails)) {
         $this->markTestSkipped('Email notification not found in the mail box');
     }
     $email = array_shift($emails);
     $this->assertRegexp('/To: ' . preg_quote(self::TESTER_EMAIL) . '/msS', $email['header'], 'Wrong email recipient: ' . $email['header']);
     $this->assertRegexp('/Sign in notification/msS', $email['body'], '"Sign in notification" text not found in the email body');
 }
Esempio n. 3
0
 /**
  * actionPostprocessModify
  *
  * @return void
  */
 protected function actionPostprocessModify()
 {
     $params = array();
     if ($this->getModelForm()->isRegisterMode()) {
         // New profile is registered
         if ($this->isActionError()) {
             // Return back to register page
             $params = array('mode' => self::getRegisterMode());
         } else {
             // Send notification to the user
             \XLite\Core\Mailer::sendProfileCreatedUserNotification($this->getProfile());
             // Send notification to the users department
             \XLite\Core\Mailer::sendProfileCreatedAdminNotification($this->getProfile());
             // Return to the created profile page
             $params = array('profile_id' => $this->getProfile()->getProfileId());
         }
     } else {
         // Existsing profile is updated
         // Send notification to the user
         \XLite\Core\Mailer::sendProfileUpdatedUserNotification($this->getProfile());
         // Send notification to the users department
         \XLite\Core\Mailer::sendProfileUpdatedAdminNotification($this->getProfile());
         // Get profile ID from modified profile model
         $profileId = $this->getProfile()->getProfileId();
         // Return to the profile page
         $params = array('profile_id' => $profileId);
     }
     if (!empty($params)) {
         $this->setReturnURL($this->buildURL('profile', '', $params));
     }
 }
Esempio n. 4
0
 /**
  * doActionRegister
  *
  * @return boolean
  */
 protected function doActionRegister()
 {
     $result = $this->getModelForm()->performAction('create');
     // Return to the created account page or to the register page
     if ($this->isActionError()) {
         // Return back to register page
         $params = array('mode' => self::getRegisterMode());
     } else {
         // Send notification to the user
         \XLite\Core\Mailer::sendProfileCreatedUserNotification($this->getModelForm()->getModelObject());
         // Send notification to the users department
         \XLite\Core\Mailer::sendProfileCreatedAdminNotification($this->getModelForm()->getModelObject());
         $params = array('profile_id' => $this->getModelForm()->getProfileId(false));
         // Log in user with created profile
         \XLite\Core\Auth::getInstance()->loginProfile($this->getModelForm()->getModelObject());
     }
     $this->setReturnURL($this->buildURL('profile', '', $params));
     return $result;
 }