mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
Merge pull request #353 from jonaspm/docs/auth-change-password
docs: Document changePassword method in auth module
This commit is contained in:
@@ -30,6 +30,25 @@ With a focus on flexibility and ease of integration, bknd's authentication syste
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Server Module: `module.auth`
|
||||||
|
|
||||||
|
### `auth.changePassword([userId], [password])`
|
||||||
|
|
||||||
|
To change a user's password, use the `changePassword` method:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
await app.module.auth.changePassword(user.id, password);
|
||||||
|
```
|
||||||
|
|
||||||
|
This method updates the password for the specified user.
|
||||||
|
- `userId`: The ID of the user whose password should be changed.
|
||||||
|
- `password`: The new password value.
|
||||||
|
|
||||||
|
This method throws an error if:
|
||||||
|
- The user with the given `userId` is not found.
|
||||||
|
- The user's authentication strategy is not `"password"` (e.g. the user registered via an OAuth provider).
|
||||||
|
|
||||||
|
|
||||||
## Securing Your Admin Portal
|
## Securing Your Admin Portal
|
||||||
|
|
||||||
<Callout type="warn" title="Do not enable the Guard without an admin user">
|
<Callout type="warn" title="Do not enable the Guard without an admin user">
|
||||||
|
|||||||
Reference in New Issue
Block a user