Fix password resetting
This commit is contained in:
parent
48bf4f26c4
commit
92c07b02cb
2 changed files with 7 additions and 7 deletions
|
@ -71,7 +71,7 @@ class ResetPasswordController extends AbstractController
|
|||
* Validates and process the reset URL that the user clicked in their email.
|
||||
*/
|
||||
#[Route('/reset/{token}', name: 'app_reset_password')]
|
||||
public function reset(Request $request, UserPasswordHasherInterface $passwordHasher, string $token = null): Response
|
||||
public function reset(Request $request, UserPasswordHasherInterface $passwordEncoder, string $token = null): Response
|
||||
{
|
||||
if ($token) {
|
||||
// We store the token in session and remove it from the URL, to avoid the URL being
|
||||
|
@ -106,12 +106,13 @@ class ResetPasswordController extends AbstractController
|
|||
$this->resetPasswordHelper->removeResetRequest($token);
|
||||
|
||||
// Encode the plain password, and set it.
|
||||
$encodedPassword = $passwordHasher->encodePassword(
|
||||
$user->setPassword(
|
||||
$passwordEncoder->hashPassword(
|
||||
$user,
|
||||
$form->get('plainPassword')->getData()
|
||||
)
|
||||
);
|
||||
|
||||
$user->setPassword($encodedPassword);
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
// The session is cleaned up after the password has been changed.
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<h1>Reset your password</h1>
|
||||
|
||||
{{ form_start(resetForm) }}
|
||||
{{ form_row(resetForm.plainPassword) }}
|
||||
<button class="btn btn-primary">Reset password</button>
|
||||
{{form_widget(resetForm)}}
|
||||
{{ form_end(resetForm) }}
|
||||
{% endblock %}
|
||||
|
|
Reference in a new issue