/**
  * @param Request       $request
  * @param FormInterface $form
  *
  * @return bool
  */
 public function handle(Request $request, FormInterface $form)
 {
     $this->logger->info('ForgotPasswordFormHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $user = $form->getData();
     $this->userManager->resetPassword($user);
     $this->flashManager->getSuccessMessage('Your password was changed successfully!');
     return true;
 }
 /**
  * @param Request       $request
  * @param FormInterface $form
  *
  * @return bool
  */
 public function handle(Request $request, FormInterface $form)
 {
     $this->logger->info('ForgotPasswordFormHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         return false;
     }
     $data = $form->getData();
     $this->logger->info('Email address is : ' . $data['email']);
     $user = $this->userManager->getByEmail($data['email']);
     if (!is_object($user)) {
         $this->flashManager->getErrorMessage('Account not found in our records.');
         $this->logger->warn('ForgotPasswordFormHandler handle() Account ' . $data['email'] . ' not found in our records.');
         return false;
     }
     $this->userManager->forgotPassword($user);
     $this->flashManager->getSuccessMessage('Your password reset link has been emailed to ' . $data['email']);
     return true;
 }
 /**
  * Handle list request.
  *
  * @param Request $request
  * @param $page
  *
  * @return array
  */
 public function handle(Request $request, $page)
 {
     $this->logger->info('MotorCoachListHandler handle()');
     $search = $request->query->get('search');
     $sort = $request->query->get('sort', 'm.updatedAt');
     $direction = $request->query->get('direction', 'DESC');
     $show = $request->query->get('show', '10');
     $options = array('search' => $search, 'sort' => $sort, 'direction' => $direction, 'show' => $show);
     $pagination = $this->paginator->paginate($this->motorCoachManager->getListAll($options), $request->query->get('page', $page), $show);
     if ($pagination->getTotalItemCount() == 0) {
         $this->flashManager->getWarningMessage('No results found.');
     }
     return array('pagination' => $pagination, 'direction' => $direction, 'show' => $show);
 }