title: Reset password in Symfony 4
body: <p>I'm stuck in implementing reset password in Symfony 4. Here the user inserts an e-mail on forgot-password form, then he receives an  email with a link which directs to reset-password form. I have the following method in my forgot-password controller: </p>
  
  <pre><code>/**
   * @Route("/forgot-password", name="forgot_password", defaults={"email=null"})
   * @Method({"GET","POST"})
   * @param Request $request
   * @param AuthenticationUtils $authenticationUtils
   * @param UserPasswordEncoderInterface $passwordEncoder
   * @param $email
   * @return Response
   */
  public function forgotpass(Request $request, \Swift_Mailer $mailer)
  {
      $form = $this-&gt;createForm(ForgotPassType::class);
      $form-&gt;handleRequest($request);
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid())
      {
          $email = $form-&gt;getData();
          $users = $this-&gt;getDoctrine()
              -&gt;getRepository(Users::class)
              -&gt;findOneBy(array('email' =&gt; $email['email']));
  
              $identifier = random_bytes(10);
  
                  $url = $this-&gt;generateUrl('reset_password', array('email'=&gt;$email['email'], 'identifier'=&gt;$identifier));
  
                  return $this-&gt;redirectToRoute('url');
  }
  </code></pre>
  
  <p>I am trying to generate the URL which will be sent via email to reset the password. The URL contains email and an identifier with reset-password link. But it is showing following errors </p>
  
  <pre><code>Unable to generate a URL for the named route "http://myweb.test/reset-password?email=email%40gmail.com&amp;identifier=%EEJ8f%A2%DEN%F0%01A" as such route does not exist.
  </code></pre>
  
  <p>Can anyone tell me please what went wrong here ? Is my approach to generate the URL ok? </p>
  
  <p>Many thanks in advance !</p>