mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-21 22:06:04 -05:00
docs: add revokeSessionsOnPasswordReset to password reset section (#8551)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c1336c563d
commit
89af592e93
@@ -374,6 +374,22 @@ const { data, error } = await authClient.resetPassword({
|
||||
```
|
||||
</APIMethod>
|
||||
|
||||
#### Revoking Sessions on Password Reset
|
||||
|
||||
By default, other active sessions are **not** revoked when a user resets their password. To revoke all user sessions on password reset, set `revokeSessionsOnPasswordReset` to `true`:
|
||||
|
||||
```ts title="auth.ts"
|
||||
export const auth = betterAuth({
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
revokeSessionsOnPasswordReset: true, // [!code highlight]
|
||||
sendResetPassword: async ({ user, url, token }, request) => {
|
||||
// your email sending logic
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Update password
|
||||
|
||||
A user's password isn't stored in the user table. Instead, it's stored in the account table. To change the password of a user, you can use one of the following approaches:
|
||||
|
||||
Reference in New Issue
Block a user