Пример #1
0
 /**
  * Constructor performs initializations actions
  */
 public function __construct()
 {
     //initialize user service
     $this->passwordRecoveryService = PasswordRecoveryService::singleton();
     $this->userService = \tao_models_classes_UserService::singleton();
     $this->defaultData();
 }
 /**
  * 
  * @param MessagingService $messagingService
  * @return PasswordRecoveryService
  */
 protected function getPasswordRecoveryService($messagingService)
 {
     $passwordRecoveryService = PasswordRecoveryService::singleton();
     $refObject = new ReflectionObject($passwordRecoveryService);
     $refProperty = $refObject->getProperty('messagingSerivce');
     $refProperty->setAccessible(true);
     $refProperty->setValue($passwordRecoveryService, $messagingService);
     return $passwordRecoveryService;
 }
Пример #3
0
 /**
  * Send message with password recovery instructions
  * 
  * @author Aleh Hutnikau <*****@*****.**>
  * @param User $user
  * @return void
  */
 private function sendMessage(core_kernel_classes_Resource $user)
 {
     try {
         $messageSent = $this->passwordRecoveryService->sendMail($user);
     } catch (Exception $e) {
         $messageSent = false;
         \common_Logger::w("Unsuccessful recovery password. {$e->getMessage()}.");
     }
     if ($messageSent) {
         $mail = $this->passwordRecoveryService->getUserMail($user);
         $this->setData('header', __('An email has been sent'));
         $this->setData('info', __('A message with further instructions has been sent to your email address: %s', $mail));
     } else {
         $this->setData('error', __('Unable to send the password reset request'));
     }
 }