How to verify password?

'use server'

import { authenticatedActionClient } from '@/lib/safe-action'
import { changeUsernameSchema } from './schema'

export const changeUsername = authenticatedActionClient
.schema(changeUsernameSchema)
.action(async ({ parsedInput }) => {
const { username, password } = parsedInput

// verify password
})
'use server'

import { authenticatedActionClient } from '@/lib/safe-action'
import { changeUsernameSchema } from './schema'

export const changeUsername = authenticatedActionClient
.schema(changeUsernameSchema)
.action(async ({ parsedInput }) => {
const { username, password } = parsedInput

// verify password
})
Is there a function that I can use to verify the password? I want the user to type the current password to confirm before changing the username.
Solution:
context.password.verify is the method you can use
Jump to solution
3 Replies
lonelyplanet
lonelyplanet7d ago
Use your auth config context const context = await auth.$context;
Solution
lonelyplanet
lonelyplanet7d ago
context.password.verify is the method you can use

Did you find this page helpful?