Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="{{path ('fos_user_profile_change_password')}}" method="POST" id="form_user_change_password">
- <div class="form-group">
- <div>
- <label for="fos_user_change_password_form_current_password" class="required">Contraseña actual</label>
- <input type="password" id="fos_user_change_password_form_current_password" name="fos_user_change_password_form[current_password]" required="required">
- </div>
- <div>
- <label for="new_password" class="required">Nueva contraseña</label>
- <input type="password" id="new_password" name="new_password" required="required">
- </div>
- <div>
- <label for="new_password_repeat" class="required">Repita la contraseña</label>
- <input type="password" name="new_password_repeat" id="new_password_repeat" required="required">
- </div>
- <div>
- <input type="submit" value="{{ 'change_password.submit'|trans }}" class="btn btn-primary btn-block uppercase" />
- </div>
- </div>
- </form>
- /**
- * Change user password.
- *
- * @param Request $request
- *
- * @return Response
- */
- public function changePasswordAction(Request $request)
- {
- $userManager = $this->get('fos_user.user_manager');
- $user = $this->getUser();
- $new_password = $_POST['new_password'];
- $user->setPassword($new_password);
- $userManager->updateUser($user);
- $url = $this->generateUrl('fos_user_profile_edit');
- $response = new RedirectResponse($url);
- return $response;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement