sooo basically Im trying to change the password of my users using FOS_USER and symphony.
the code goes as follows (it's the same code as the one on ChangePasswordAction in the FOS_User symphony bundle but the response has been changed to use AJAX
public function changePasswordAction(Request $request) {
// $form = $this->createForm(new ChangePasswordFormType('Bandness\BandeeBundle\Entity\Bandee'), $this->getUser());
$user = $this->getUser();
$dispatcher = $this->container->get('event_dispatcher');
$event = new GetResponseUserEvent($user, $request);
$dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_INITIALIZE, $event);
if (null !== $event->getResponse()) {
return $event->getResponse();
}
$formFactory = $this->container->get('fos_user.change_password.form.factory');
$form = $formFactory->createForm();
$form->setData($user);
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
/** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
$userManager = $this->container->get('fos_user.user_manager');
$event = new FormEvent($form, $request);
$dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_SUCCESS, $event);
$userManager->updateUser($user);
$dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_COMPLETED, new FilterUserResponseEvent($user, $request, new Response()));
return new JsonResponse($this->get('translator')->trans('Bandee.config.changepass.success'),200);
}
else return new JsonResponse($this->getTranslatedErrors($form), 422);
}
the thing is that this doesn't seem to be working. when in an apache2 with php 5.3.6 it works perfectly, however on other machines it just doesnt work. the reply it normally gives is "not a valid number" , which doesn't make sense because it shouldn't check a number at all...
i feel there is a bug in FOS_User and some versions of PHP it's not working on PHP Version 5.4.4 neither on 5.3.10
any suggestions?