#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=../lib/common.sh
source "${ROOT}/lib/common.sh"

require_env TOKEN
CURRENT="${CURRENT_PASSWORD:-password123}"
NEW_PASSWORD="${NEW_PASSWORD:-new-password-789}"

curl_post_bearer_json "/change-password" "${TOKEN}" \
  "$(printf '%s' "{\"currentPassword\":\"${CURRENT}\",\"newPassword\":\"${NEW_PASSWORD}\"}")" | pretty
