title: Get user's plain password on registration with FOSUser bundle
body: <p>I'm using the FosUserBundle to handle my application login/registration workflows. Then I need to obtain the user's plain password on registration, because I would like to generate an access token using the <code>grant_type=password</code> workflow with the FOSOAuthServer bundle.</p>
  
  <p>I tried with the following events:</p>
  
  <ul>
  <li><code>FOSUserEvents::REGISTRATION_INITIALIZE</code> : No password here</li>
  <li><code>FOSUserEvents::REGISTRATION_SUCCESS</code> : Plain password but no user in database because this event is called right before the user creation</li>
  <li><code>FOSUserEvents::REGISTRATION_COMPLETED</code>: The user is created in the database, but the <code>$event-&gt;getUser()-&gt;getPlainPassword()</code> return null, because on user creation the method <code>$userManager-&gt;updatePassword()</code> set the <code>plainPassword</code> attribute to null</li>
  </ul>
  
  <p>Do you have any secure idea of how can I handle this? I've got to main ideas but I'm not sure if it is the right way to do it:</p>
  
  <ul>
  <li>Put the password in session on <code>FOSUserEvents::REGISTRATION_SUCCESS</code> and generate the access token then remove the password on <code>FOSUserEvents::REGISTRATION_COMPLETED</code></li>
  <li>Override the user manager class to make the method <code>$userManager-&gt;updatePassword()</code> do no call <code>$userManager-&gt;eraseCredentials()</code> and use it on registration (not surehow to do it)</li>
  </ul>
  
  <p>Cheers guys :)</p>