Controller/Auth/PasswordResetController.php
public function createAction(Request $request)
    {
        $form = $this->getResetForm();
        $form->bind($request);

        if ($form->isValid()) {
            $email = $form->get('email')->getData();
            $em = $this->getDoctrine()->getManager();
            $user = $em->getRepository('OrkestraApplicationBundle:User')->findOneBy(array('email' => $email));

            if ($user) {
                $passwordHelper = $this->get('orkestra.application.helper.password');
                $hashedEntity = $passwordHelper->sendPasswordResetEmail($user, 'Password Reset Request');

                $em->persist($user);
                $em->persist($hashedEntity);
                $em->flush();

                return new JsonSuccessResponse('Your password has been reset. Please check your email for further instructions.');
            }
        }

        sleep(2);

        return new JsonErrorResponse('Invalid or unknown email address');
    }
public function createAction(Request $request)
    {
        $form = $this->getResetForm();
        $form->bind($request);

        if ($form->isValid()) {
            $email = $form->get('email')->getData();
            $em = $this->getDoctrine()->getManager();
            $user = $em->getRepository('OrkestraApplicationBundle:User')->findOneBy(array('email' => $email));

            if ($user) {
                $passwordHelper = $this->get('orkestra.application.helper.password');
                $hashedEntity = $passwordHelper->sendPasswordResetEmail($user, 'Password Reset Request');

                $em->persist($user);
                $em->persist($hashedEntity);
                $em->flush();

                return new JsonSuccessResponse('Your password has been reset. Please check your email for further instructions.');
            }
        }

        sleep(2);

        return new JsonErrorResponse('Invalid or unknown email address');
    }
public function createAction ( Request $ request ) { $ form = $ this -> getResetForm ( ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ email = $ form -> get ( 'email' ) -> getData ( ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ user = $ em -> getRepository ( 'OrkestraApplicationBundle:User' ) -> findOneBy ( array ( 'email' => $ email ) ) ; if ( $ user ) { $ passwordHelper = $ this -> get ( 'orkestra.application.helper.password' ) ; $ hashedEntity = $ passwordHelper -> sendPasswordResetEmail ( $ user , 'Password Reset Request' ) ; $ em -> persist ( $ user ) ; $ em -> persist ( $ hashedEntity ) ; $ em -> flush ( ) ; return new JsonSuccessResponse ( 'Your password has been reset. Please check your email for further instructions.' ) ; } } sleep ( 2 ) ; return new JsonErrorResponse ( 'Invalid or unknown email address' ) ; }
Resets a user's password and emails them the temporary password

@Route("/reset-password/reset", name="orkestra_password_reset_create", defaults={"_format"="json"})
@Method("POST")
Resets a user s password and emails them the temporary password