Exemplo n.º 1
0
 /**
  * requestRecoverPassword
  *
  * @param mixed $email ____param_comment____
  *
  * @return void
  */
 protected function requestRecoverPassword($email)
 {
     $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findByLogin($email);
     if (isset($profile)) {
         \XLite\Core\Mailer::sendRecoverPasswordRequest($profile->getLogin(), $profile->getPassword());
     }
     return isset($profile);
 }
Exemplo n.º 2
0
 /**
  * Sent Recover password mail
  *
  * @param string $email Email
  *
  * @return boolean
  */
 protected function requestRecoverPassword($email)
 {
     $result = false;
     $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findByLogin($email);
     if (isset($profile) && !$profile->isAdmin()) {
         if ('' == $profile->getPasswordResetKey() || 0 == $profile->getPasswordResetKeyDate() || \XLite\Core\Converter::time() > $profile->getPasswordResetKeyDate()) {
             // Generate new 'password reset key'
             $profile->setPasswordResetKey($this->generatePasswordResetKey());
             $profile->setPasswordResetKeyDate(\XLite\Core\Converter::time() + static::PASSWORD_RESET_KEY_EXP_TIME);
             $profile->update();
         }
         \XLite\Core\Mailer::sendRecoverPasswordRequest($profile->getLogin(), $profile->getPasswordResetKey());
         $result = true;
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * testSendRecoverPasswordRequest
  * TODO: add this test
  *
  * @return void
  * @access public
  * @see    ____func_see____
  * @since  1.0.0
  */
 public function testSendRecoverPasswordRequest()
 {
     $profile = self::$admin_profile;
     $this->startCheckingMail();
     \XLite\Core\Mailer::sendRecoverPasswordRequest(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('/ you have requested to recover your forgotten/', $email['body']);
     $this->assertTrue($result, 'Check if email contents keywords');
 }