Update logged user password.

@param LoggedUserNameUpdate $request
@return JsonResponse|\App\User|null
183345
public function update(LoggedUserNameUpdate $request)
    {
        $user = Auth::user();
        $user->update($request->only('name'));
        return $user;
    }
440774
public function update(Request $request, User $user)
    {
        $this->authorize('update', $user);
        $this->validate($request, [
            'name'     => 'required|max:255',
        ]);

        $user->update([
            'name' => $request->name,
        ]);

        return redirect()->route('laralum::users.index');
    }
56408
public function update(Request $request, $id)
    {
        // Validate the form data
        $result = $this->validate($request, [
            'email' => 'required|email|max:255|unique:users,email,'.$id,
            'password' => 'nullable|confirmed|min:6',
        ]);

        // Assemble the updated attributes
        $attributes = [
            'email' => trim($request->get('email')),
            'first_name' => $request->get('first_name', null),
            'last_name' => $request->get('last_name', null)
        ];

        // Do we need to update the password as well?
        if ($request->has('password')) {
            $attributes['password'] = $request->get('password');
        }

        // Fetch the user object
        $user = $this->userRepository->findById($id);
        if (!$user) {
            if ($request->expectsJson()) {
                return response()->json("Invalid user.", 422);
            }
            session()->flash('error', 'Invalid user.');
            return redirect()->back()->withInput();
        }

        // Update the user
        $user = $this->userRepository->update($user, $attributes);

        // Update role assignments
        $roleIds = array_values($request->get('roles', []));
        $user->roles()->sync($roleIds);

        // All done
        if ($request->expectsJson()) {
            return response()->json(['user' => $user], 200);
        }

        session()->flash('success', "{$user->email} has been updated.");
        return redirect()->route('users.index');
    }
1232222
public function update(Request $request)
    {
        $user = $request->user();

        $this->validate($request, [
            'name' => 'required',
            'email' => 'required|email|unique:users,email,'.$user->id,
        ]);

        return tap($user)->update($request->only('name', 'email'));
    }
921527
public function updatePassword($username, $password)
    {
        $parameters['username'] = $username;
        $parameters['password'] = $password;
        return $this->apiClient->callEndpoint(
            sprintf('%s/avatars', self::ENDPOINT),
            $parameters,
            null,
            HttpMethod::REQUEST_PUT
        );
    }
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')
        );
    }
550644
public function update($id, UpdateUserRequest $request)
    {
        $user = $this->repository->findWithoutFail($id);

        if (empty($user)) {
            return $this->sendError('User not found');
        }

        $user = $this->repository->update($request->all(), $id);
        $user->load($request->getWith());

        return $this->sendResponse($user, 'User updated successfully.');
    }
151997
public function update(Request $request, $id = null)
    {
        // validate
        $this->registerValidators();

        // check auth if update me
        if (!$id && !$this->checkAuth()) {
            return response()->json(null, 401);
        }

        // check user
        $user = $id ? AppUser::find($id) : Auth::user();

        if (!$user) {
            return response()->json(null, 404);
        }

        $request->id = $id;
        // validate data
        $validator = Validator::make($request->all(), [
            'name'         => 'sometimes|required|max:255',
            'email'        => 'sometimes|required|email|max:255|unique:users,email,'.$user->id,
            'old_password' => 'sometimes|required|changePassword|min:6',
            'password'     => 'sometimes|required|changePassword|confirmed|min:6',
            'username'     => 'string|max:30',
            'country'      => 'string|max:100',
            'location'     => 'string|max:100',
            'biography'    => 'string|max:255',
            'occupation'   => 'string|max:255',
            'website'      => 'string|max:255',
            'image'        => 'string|max:255',
            'gender'       => 'integer',
            'birthday'     => 'date'
        ]);

        if ($validator->fails()) {
            return response()->json(arrayView('phpsoft.users::errors/validation', [
                'errors' => $validator->errors()
            ]), 400);
        }

        // Update profile
        $user = $user->update($request->all());

        if (!$user) {
            return response()->json(null, 500); // @codeCoverageIgnore
        }

        return response()->json(arrayView('phpsoft.users::user/read', [
            'user' => $user
        ]), 200);
    }
456433
public function update(UpdateRequest $request)
    {
        $requestEntity = $this->repository->find($request->id);

        // TODO What's happening in here?
        if (!$requestEntity instanceof RequestEntity) {
            return response(404);
        }

        $requestEntity->update($request->all());
        $this->repository->flush();

        return response(['data' => $requestEntity->toArray()], 200);
    }
920394
public function updateAccount(Request $request)
    {
        $this->validator($request->all())->validate();

        $user = Auth::user();
        $user->name = $request->input('name');
        $user->email = $request->input('email');

        if ($request->input('password') !== null) {
            $user->password = bcrypt($request->input('password'));
        }

        $user->save();

        return redirect()
            ->route('voyager-frontend.account')
            ->with([
                'message' => __('Account Updated'),
                'alert-type' => 'success',
            ]);
    }
1258559
public function reset_password($username)
	{
		// get the user object
		$user = \Model\Auth_User::query()
			->select(\Config::get('ormauth.table_columns', array()))
			->where('username', '=', $username)
			->get_one();

		// and bail out if not found
		if ( ! $user)
		{
			throw new \SimpleUserUpdateException('Failed to reset password, user was invalid.', 8);
		}

		// generate a new random password
		$new_password = \Str::random('alnum', 8);
		$user->password = $this->hash_password($new_password);

		// store the updated password hash
		$user->save();

		// and return the new password
		return $new_password;
	}
113291
public function update(Update $request, $id)
    {
        try {
            $data = !$request->has('password') ? $request->except('password') : $this->inputAll();

            $user = $this->repository->findById($id);

            $user->update($data);

            $user->roles()->sync((array) \Input::get('role'));

            return $this->redirect('users.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
801712
function doUpdatePassword(Userinfo $userinfo, Userinfo &$existinguser)
	{
		$changed = false;

		if (!empty($userinfo->password_clear) && strlen($userinfo->password_clear) != 32) {
			// add password_clear to existinguser for the Joomla helper routines
			$existinguser->password_clear = $userinfo->password_clear;
			//check if the password needs to be updated
			try {
				$model = Factory::getAuth($this->getJname());
				if ($model->checkPassword($existinguser) !== true) {
					try {
						$this->updatePassword($userinfo, $existinguser);
						$changed = true;
					} catch (Exception $e) {
						$this->debugger->addError(Text::_('PASSWORD_UPDATE_ERROR') . ' ' . $e->getMessage());
					}
				} else {
					$this->debugger->addDebug(Text::_('SKIPPED_PASSWORD_UPDATE') . ':' . Text::_('PASSWORD_VALID'));
				}
			} catch (Exception $e) {
				$this->debugger->addError(Text::_('SKIPPED_PASSWORD_UPDATE') . ':' . $e->getMessage());
			}
		} else {
			$this->debugger->addDebug(Text::_('SKIPPED_PASSWORD_UPDATE') . ': ' . Text::_('PASSWORD_UNAVAILABLE'));
		}
		return $changed;
	}
32645
public function updateAction(Request $request)
    {
        $formData = $this->decodeRequest($request);

        // dump current profile configuration (to know what to remove later)
        /** @var Facet[] $facets */
        $facets = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')->findAll();

        $this->om->startFlushSuite();

        // updates facets data
        $updatedFacets = [];
        foreach ($formData as $facetData) {
            $updated = $this->crud->update(
                'Claroline\CoreBundle\Entity\Facet\Facet',
                $facetData,
                [Options::DEEP_DESERIALIZE]
            );
            $updatedFacets[$updated->getId()] = $updated;
        }

        // removes deleted facets
        foreach ($facets as $facet) {
            if (empty($updatedFacets[$facet->getId()])) {
                $this->crud->delete($facet);
            }
        }

        $this->om->endFlushSuite();

        return new JsonResponse(
            $this->serializer->serialize()
        );
    }
58963
public function update(AccountAttributesRequest $request)
    {
        $data = $request->validated();
        $currentUser = $request->user($this->getGuard());

        // Update profile
        $currentUser->fill($data)->save();

        return intend([
            'back' => true,
            'with' => ['success' => trans('cortex/auth::messages.account.updated_attributes')],
        ]);
    }
383291
public function updateContact(UpdateProfileContactRequest $request)
    {
        $this->user->update($request->all(), $this->auth->id());

        flash(trans('core::messages.resource.resource updated', ['name' => trans('user::profile.title.profile')]));

        return redirect()->back();
    }
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'));
      }