5.1.0 • Published 1 month ago

@nextcloud/password-confirmation v5.1.0

Weekly downloads
1,831
License
MIT
Repository
github
Last release
1 month ago

@nextcloud/password-confirmation

npm Build 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@nextcloud/vue@nextcloud/password-confirmation
28.x8.x5.x
25.x - 27.x7.x2.x - 4.x
< 25.x-1.x

Installation

npm add @nextcloud/password-confirmation

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
    }
}

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>

Releasing

1) Create release branch 2) Adjust version using npm version vx.y.z --no-git-tag-version 3) Update CHANGELOG.md 4) Commit and open PR 5) After merge, pull latest main 6) git tag vx.y.z 7) git push origin vx.y.z 8) npm ci && npm run build && npm publish

5.1.0

1 month ago

5.0.1

5 months ago

5.0.0

7 months ago

4.1.0

7 months ago

4.0.4

1 year ago

4.0.3

1 year ago

4.0.2

2 years ago

3.0.1

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.0.0

2 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.7.0

4 years ago

0.6.0

5 years ago

0.5.0

5 years ago