/auth/{dbname}/change_password:
  post:
    tags:
      - auth
    summary: Change a user's password
    description: Changes a user account's password by providing the current and new passwords
    parameters:
      - name: dbname
        in: path
        description: name of the database
        required: true
        schema:
          type: string
          example: mydb
    requestBody:
      description: request object
      content:
        'application/json':
          schema:
            type: object
            properties:
              uid:
                type: string
                description: Account's uid
              password:
                type: string
                description: Current password set on the account
              new_password:
                type: string
                description: New password to set on the account
            required:
              - uid
              - password
              - new_password
    responses:
      200:
        description: If the password change is successful, returns an object with a new access token
        content:
          'application/json':
            schema:
              type: object
              properties:
                access_token:
                  description: New access token that provides access to API calls that require authentication.
                  type: string
                  example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
      400:
        description: Returns a `"400 Bad Request"` if the sent request is invalid. If the request is missing details, response is the string `"Bad Request"`. Otherwise, it's an object with `code` and `message` properties. Possible codes are `"unknown_uid"`, `"wrong_password"`, `"wrong_access_token"` (if not signed in as the user the password change was requested for)
        content:
          'text/plain':
            schema:
              type: string
              value: Bad Request
              example: Bad Request
          'application/json':
            schema:
              $ref: '#/components/schemas/Error'
              example:
                code: wrong_access_token
                message: "Cannot change password while signed in as other user, or with an old token"
      422:
        description: New password does not meet the criteria
        content:
          'text/plain':
            schema:
              type: string
              value: "Invalid new password, must be at least 8 characters and contain a combination of numbers and letters (both lower and uppercase)"
              example: "Invalid new password, must be at least 8 characters and contain a combination of numbers and letters (both lower and uppercase)"
      500:
        description: An unexpected error occurred
        content:
          'application/json':
            schema:
              $ref: '#/components/schemas/UnexpectedError'