|
@@ -14,40 +14,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
14
|
14
|
*/
|
15
|
15
|
class ResettingController extends BaseResettingController
|
16
|
16
|
{
|
17
|
|
-
|
18
|
|
- /**
|
19
|
|
- * Reset user password
|
20
|
|
- */
|
21
|
|
- public function resetAction($token)
|
22
|
|
- {
|
23
|
|
- $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);
|
24
|
|
-
|
25
|
|
- if (null === $user){
|
26
|
|
- throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
|
27
|
|
- }
|
28
|
|
-
|
29
|
|
- if (!$user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
|
30
|
|
- return new RedirectResponse($this->container->get('router')->generate('fos_user_resetting_request'));
|
31
|
|
- }
|
32
|
|
-
|
33
|
|
- $form = $this->container->get('fos_user.resetting.form');
|
34
|
|
- $formHandler = $this->container->get('fos_user.resetting.form.handler');
|
35
|
|
- $process = $formHandler->process($user);
|
36
|
|
-
|
37
|
|
- if ($process) {
|
38
|
|
- $this->authenticateUser($user);
|
39
|
|
-
|
40
|
|
- $this->setFlash('success', 'Votre mot de passe a été mis a jour avec succés.');
|
41
|
|
-
|
42
|
|
- return new RedirectResponse($this->getRedirectionUrl($user));
|
43
|
|
- }
|
44
|
|
-
|
45
|
|
- return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:reset.html.'.$this->getEngine(), array(
|
46
|
|
- 'token' => $token,
|
47
|
|
- 'form' => $form->createView(),
|
48
|
|
- 'theme' => $this->container->getParameter('fos_user.template.theme'),
|
49
|
|
- ));
|
50
|
|
- }
|
51
|
17
|
|
52
|
18
|
/**
|
53
|
19
|
* Generate the redirection url when the resetting is completed.
|