title: Symfony login success redirect to change password screen
body: <p>Admin generate user then user first time login i want to redirect user to change password.</p>
  
  <p>I have google but there are no any post found that make this fix.</p>
  
  <p>Below i have attached service.yml and loginsuccessListener file code.</p>
  
  <p><strong>service.yml</strong></p>
  
  <pre><code>services:               
      fos_user.security.interactive_login_listener:
          class: OnlineCare\MarketingWebBundle\EventListener\LastLoginListener
          tags:
              - { name: kernel.event_subscriber, event: kernel.request, method: onKernelRequest }
          arguments: ['@fos_user.user_manager','@router','@service_container']
  </code></pre>
  
  <p><strong>LastLoginListiner.php</strong>   </p>
  
  <pre><code>namespace OnlineCare\MarketingWebBundle\EventListener;
  
  use FOS\UserBundle\FOSUserEvents;
  use FOS\UserBundle\Event\UserEvent;
  use FOS\UserBundle\Model\UserManagerInterface;
  use FOS\UserBundle\Model\UserInterface;
  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
  use Symfony\Component\Security\Http\SecurityEvents;
  
  use Symfony\Component\HttpFoundation\RedirectResponse;
  use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  use Symfony\Component\DependencyInjection\ContainerInterface;
  
  class LastLoginListener implements EventSubscriberInterface
  {
      protected $userManager;
      private $router;
      private $container;
  
      public function __construct(UserManagerInterface $userManager, UrlGeneratorInterface $router, ContainerInterface $container)
      {
          $this-&gt;userManager = $userManager;
          $this-&gt;router = $router;
          $this-&gt;container = $container;
      }
  
      public static function getSubscribedEvents()
      {
          return array(
              FOSUserEvents::SECURITY_IMPLICIT_LOGIN =&gt; 'onImplicitLogin',
              SecurityEvents::INTERACTIVE_LOGIN =&gt; 'onSecurityInteractiveLogin',
          );
      }
  
      public function onImplicitLogin(UserEvent $event)
      {
          $user = $event-&gt;getUser();
  
          $user-&gt;setLastLogin(new \DateTime());
          $this-&gt;userManager-&gt;updateUser($user);
      }
  
      public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
      {
          $user = $event-&gt;getAuthenticationToken()-&gt;getUser();
  
          if(empty($user-&gt;getLastLogin())){
  
              $url = $this-&gt;router-&gt;generate('fos_user_change_password');
              **return $event-&gt;setResponse(new RedirectResponse($url));**
  
          } elseif ($user instanceof UserInterface) {
              $user-&gt;setLastLogin(new \DateTime());
              $this-&gt;userManager-&gt;updateUser($user);
          }
      }
  }
  </code></pre>