Update the specified User Password in storage.

@param \AvoRed\Framework\User\Requests\ChnagePasswordRequest $request
@param \AvoRed\Framework\Models\Database\User $user

@return \Illuminate\Http\RedirectResponse
162991
public function changePasswordUpdate(ChangePasswordRequest $request, User $user)
    {
        $password = $request->get('password');
        $user->update(['password' => bcrypt($password)]);
        Mail::to($user->email)->send(new ChangePasswordMail($user, $password));

        return redirect()->route('admin.user.index');
    }
981749
public function updatePasswordAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $user = $em->getRepository('ChillMainBundle:User')->find($id);

        if (!$user) {
            throw $this->createNotFoundException('Unable to find User entity.');
        }

        $editForm = $this->createEditPasswordForm($user);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $password = $editForm->getData()->getPassword();
            
            // logging for debug !! WARNING print the new password !!
            $this->get('logger')->debug('update password for an user', 
                    array('method' => __METHOD__, 'password' => $password, 
                        'user' => $user->getUsername()));
            // logging for prod
            $this->get('logger')->info('update password for an user', 
                    array('method' => __METHOD__, 'user' => $user->getUsername()));
            
            $user->setPassword($this->get('security.password_encoder')
                    ->encodePassword($user, $password));
            
            $em->flush();
            
            $this->addFlash('success', $this->get('translator')->trans('Password successfully updated!'));

            return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id)));
        }

        return $this->render('ChillMainBundle:User:edit_password.html.twig', array(
            'entity'      => $user,
            'edit_form'   => $editForm->createView(),
        ));
    }
586060
protected function updateUser(FormInterface $form, UserInterface $user)
    {
        /** @var \Symfony\Component\Security\Core\Encoder\EncoderFactory $encoderFactory */
        $encoderFactory = $this->container->get('security.encoder_factory');

        /** @var \Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface $encoder */
        $encoder = $encoderFactory->getEncoder($user);

        if ($form->has('current_password')) {
            if (!$encoder->isPasswordValid($user->getPassword(), $form->get('current_password')->getData(), $user->getSalt())) {
                /** @var View $view */
                $view = $this->container->get('symfonyid.admin.view.view');
                $view->setParam('current_password_invalid', true);
                $view->setParam('form', $form->createView());

                return $this->container->get('templating')->renderResponse('SymfonyIdAdminBundle:Index:change_password.html.twig', $view->getParams());
            }
        }

        /** @var \FOS\UserBundle\Model\UserManager $userManager */
        $userManager = $this->container->get('fos_user.user_manager');
        $userManager->updateUser($form->getData());
    }
66836
private function encodePassword(User $user)
    {
        $password = $this->encoderFactory
            ->getEncoder($user)
            ->encodePassword($user->getPlainPassword(), $user->getSalt());

        $user->setPassword($password);

        return $password;
    }
1225554
public function update(Request $request, $id)
    {
      $user = $this->users->findOrFail($id);
      $input = $request->all();
      $input['password'] = Hash::make($input['password']);
      $user->update($input);
      return \Redirect::route('admin.users.index', [
        ])->withMessage(trans('acl::user.users-controller-successfully_updated'));
      }
324320
public function store(CreateUser $request)
    {
        $request->merge(['password' => bcrypt($request->get('password'))]);

        try {
            $user = UserProxy::create($request->except('roles'));
            $user->syncRoles($request->roles());

            flash()->success(__('User has been created'));
        } catch (\Exception $e) {
            flash()->error(__('Error: :msg', ['msg' => $e->getMessage()]));
            return redirect()->back();
        }

        //@todo process route prefixes based on box config
        return redirect(route('appshell.user.index'));
    }
814273
public function savepasswordAction(Request $request)
    {
        $user = $this->getUser();

        if ($request->request->has('password')) {
            $user->setPlainPassword($request->request->get('password'));
        }

        $this->get('phlexible_user.user_manager')->updateUser($user);

        return new ResultResponse(true, 'User password saved.');
    }
440748
public function forgotPassword(Request $request): Response
    {
        $form = $this->createForgotPasswordForm();
        $form->handleRequest($request);

        if (!$form->isValid()) {
            return $this->render(
                $this->getConfigResolver()->getParameter('template.user.forgot_password', 'ngsite'),
                [
                    'form' => $form->createView(),
                ]
            );
        }

        $users = $this->userService->loadUsersByEmail($form->get('email')->getData());

        $passwordResetRequestEvent = new UserEvents\PasswordResetRequestEvent(
            $form->get('email')->getData(),
            $users[0] ?? null
        );

        $this->eventDispatcher->dispatch(SiteEvents::USER_PASSWORD_RESET_REQUEST, $passwordResetRequestEvent);

        return $this->render(
            $this->getConfigResolver()->getParameter('template.user.forgot_password_sent', 'ngsite')
        );
    }
121439
public function updatePassword(User $user, $password) : User
    {
        $user->updatePassword($password);
        $this->repository->add($user);

        return $user;
    }
1251498
public function store(UserRequest $request)
    {
        $input = $request->except('roles');

        if ($request->has('password')) {
            $input['password'] = bcrypt($request->password);
        } else {
            unset($input['password']);
        }

        $record = $this->model->create($input);

        if ($request->has('roles')) {
            $record->syncRoles($request->roles);
        }

        $this->notify([
            'type' => 'success',
            'title' => 'Successful create user!',
            'description' => 'User is created successfully!',
        ]);

        return redirect(route('user.edit', ['id' => $record->id]));
    }
592643
public function update( models\VPN\Server\User $user){
        $rest = $this->getService( self::API_VPN_USER . $user->getLogin());
        $rest->PUT( $user);

        return $rest->getResult( models\VPN\Server\User::class);
    }
733558
public function update(User $user)
    {
        $url = 'users/' . $user->getAppuserid();

        return $this->updateObject($url, $user);
    }
800810
public function update(UserUpdateRequest $request)
    {
        try {
            if ($this->service->update(auth()->id(), $request->all())) {
                return back()->with('message', 'Settings updated successfully');
            }

            return back()->withErrors(['Could not update user']);
        } catch (Exception $e) {
            return back()->withErrors($e->getMessage());
        }
    }
579615
public function store(CreateUserRequest $request)
    {
        $user = $this->user->fill($request->except('password'));

        if($request->filled('password')) $user->password = bcrypt($request->password);
        if($request->filled('is_admin')) $user->is_admin = 1;

        $user->save();

        return redirect('admin/users');
    }
1260098
public function changePassword(User $user)
    {
        if ($user->isGuest()) {
            Throw new UserException('Cannot change password of a guest.');
        }

        if (empty($user->getPassword())) {
            Throw new UserException('Cannot change an empty password');
        }

        $hashgen = new HashGenerator($user->getPassword());
        $hashgen->setSalt($this->salt);
        $password = $hashgen->generate();

        // Check the old password
        $this->db->qb([
            'table' => $this->table,
            'method' => 'UPDATE',
            'fields' => 'password',
            'filter' => 'id_user=:id_user',
            'params' => [
                ':id_user' => $user->getId(),
                ':password' => $password
            ]
        ], true);

        $user->setPassword($password);
    }
756410
protected static function updateUserPassword($users)
    {
        if (!empty($users)) {
            foreach ($users as $i => $user) {
                if (isset($user['password'])) {
                    /** @type User $model */
                    $model = User::where('email', '=', $user['email'])->first();
                    $model->updatePasswordHash($user['password']);
                }
            }
        }
    }
700555
public function preUpdate(User $user, PreUpdateEventArgs $event)
    {
        if ($event->hasChangedField('password')) {
            $event->setNewValue('password', $this->encodePassword($user));
        }
    }