@nextcloud/password-confirmation
    Preparing search index...

    Function withStrictPasswordConfirmation

    • Group multiple requests that require strict password confirmation, so the user only needs to enter the password once.

      The password is validated once before the callback is executed, then all requests made with the axios instance passed to the callback are authenticated with the confirmed password.

      Type Parameters

      • T

      Parameters

      • callback: (axios: AxiosInstance) => Promise<T>

        Function performing the requests using the provided axios instance

      • options: { axios?: AxiosInstance; text?: string } = {}

        Additional options

        • Optionalaxios?: AxiosInstance

          The axios instance to use, defaults to @nextcloud/axios

        • Optionaltext?: string

          Custom text to show in the dialog, instead of the default text

      Returns Promise<T>

      Promise resolving to the return value of the callback. Rejects with PasswordConfirmationCancelledError if password confirmation was cancelled.

      await withStrictPasswordConfirmation(async (axios) => {
      await axios.put(...)
      await axios.get(...)
      }, { text: t('myapp', 'The following apps will be updated …') })