/**
  * Generate forgot password random string and dispatch an event.
  *
  * @param User $user
  * @return User
  */
 public function forgotPassword(\MlankaTech\AppBundle\Entity\User $user)
 {
     $this->logger->info('Service UserManager forgotPassword()');
     $user->setForgotPassword($this->generateRandomString(8));
     $user->setPasswordRequestedAt(new \DateTime());
     $this->em->persist($user);
     $this->em->flush();
     $this->eventDispatcher->dispatch(UserEvents::ON_ACCOUNT_FORGOT_PASSWORD, new UserEvent($user));
     return $user;
 }