Exemplo n.º 1
0
 /**
  * recoverPassword
  *
  * @param mixed $email     ____param_comment____
  * @param mixed $requestID ____param_comment____
  *
  * @return void
  */
 protected function doPasswordRecovery($email, $requestID)
 {
     $result = true;
     $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findByLogin($email);
     if (!isset($profile) || $profile->getPassword() != $requestID) {
         $result = false;
     } else {
         $pass = generate_code();
         $profile->setPassword(md5($pass));
         $result = $profile->update();
         if ($result) {
             // Send notification to the user
             \XLite\Core\Mailer::sendRecoverPasswordConfirmation($email, $pass);
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * testSendRecoverPasswordConfirmation
  * TODO: add this test
  *
  * @return void
  * @access public
  * @see    ____func_see____
  * @since  1.0.0
  */
 public function testSendRecoverPasswordConfirmation()
 {
     $profile = self::$admin_profile;
     $this->startCheckingMail();
     \XLite\Core\Mailer::sendRecoverPasswordConfirmation(self::TESTER_EMAIL, self::TESTER_PASSWORD);
     sleep(3);
     $emails = $this->finishCheckingMail();
     if (empty($emails)) {
         $this->markTestSkipped('Email notification not found in the mail box');
     }
     $email = array_shift($emails);
     $result = (bool) preg_match('/Your new password: '******'/', $email['body']);
     $this->assertTrue($result, 'Check if email contents keywords');
 }