Socket
Book a DemoInstallSign in
Socket

@nextcloud/password-confirmation

Package Overview
Dependencies
Maintainers
9
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextcloud/password-confirmation

Password confirmation for Nextcloud

Source
npmnpm
Version
6.0.2
Version published
Weekly downloads
4.3K
9.34%
Maintainers
9
Weekly downloads
 
Created
Source

@nextcloud/password-confirmation

npm Build status REUSE status License

Promise-based password confirmation for Nextcloud.

This library exports a function that displays a password confirmation dialog when called and returns a promise. This makes it easier to integrate with other asynchronous operations.

Versions compatibility

@nextcloud/password-confirmationMaintainedNextcloud@nextcloud/vue
6.x31+9.x (Vue 3) ¹
5.x28-328.x
2.x - 4.x25-277.x
1.x< 25-

¹: In version 6.x the @nextcloud/vue dependency is moved to dependencies so you can also use this library with an old version of @nextcloud/vue in your app dependencies if your app still uses Vue 2. Note that this might increase the bundled app size. If your app also already uses @nextcloud/vue version 9.x and Vue 3 then the bundle size will not increase.

Installation

npm install @nextcloud/password-confirmation

Usage

Direct usage

import { confirmPassword } from '@nextcloud/password-confirmation'
import '@nextcloud/password-confirmation/style.css' // Required for dialog styles

const foo = async () => {
    try {
        await confirmPassword()
        // Your logic
    } catch (error) {
        // Your error handling logic
    }
}

Usage with axios interceptor

import axios from '@nextcloud/axios'
import { addPasswordConfirmationInterceptors, PwdConfirmationMode } from '@nextcloud/password-confirmation'
import '@nextcloud/password-confirmation/style.css' // Required for dialog styles

addPasswordConfirmationInterceptors(axios)

const foo = async () => {
    try {
        const response = await axios.request({
            confirmPassword: PwdConfirmationMode.Strict,
            method,
            url,
            data: this.getData(),
        })
        // Your logic
    } catch (error) {
        // Your error handling logic
    }
}

API Reference

/**
 * Check if password confirmation is required according to the last confirmation time.
 * Use as a replacement of deprecated `OC.PasswordConfirmation.requiresPasswordConfirmation()`.
 * Not needed if `confirmPassword()` can be used, because it checks requirements itself.
 *
 * @return {boolean} Whether password confirmation is required or was confirmed recently
 */
declare function isPasswordConfirmationRequired(): boolean

/**
 * Confirm password if needed.
 * Replacement of deprecated `OC.PasswordConfirmation.requirePasswordConfirmation(callback)`
 *
 * @return {Promise<void>} Promise that resolves when password is confirmed or not needded.
 *                         Rejects if password confirmation was cancelled
 *                         or confirmation is already in process.
 */
declare function confirmPassword(): Promise<void>

/**
 * Lax: Confirm password if needed.
 * Strict: Confirm in the request.
 */
export enum PwdConfirmationMode {
	Lax = 'lax',
	Strict = 'strict',
}

Releasing

  • Create release branch
  • Adjust version using npm version vx.y.z --no-git-tag-version
  • Update CHANGELOG.md
  • Commit and open PR
  • After merge, pull latest main
  • git tag vx.y.z
  • git push origin vx.y.z
  • npm ci && npm run build && npm publish

Keywords

nextcloud

FAQs

Package last updated on 06 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts