Postgres
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { auth, getSanitizedHeaders } from '@/lib/auth'
|
||||
import { prisma } from '@innungsapp/shared'
|
||||
import { redirect } from 'next/navigation'
|
||||
// @ts-ignore
|
||||
import { hashPassword } from 'better-auth/crypto'
|
||||
|
||||
@@ -25,7 +24,6 @@ export async function changePasswordAndDisableMustChange(prevState: any, formDat
|
||||
}
|
||||
|
||||
const userId = session.user.id
|
||||
const slug = formData.get('slug') as string
|
||||
|
||||
// Hash and save new password directly — user is already authenticated so no old password needed
|
||||
const newHash = await hashPassword(newPassword)
|
||||
@@ -64,5 +62,9 @@ export async function changePasswordAndDisableMustChange(prevState: any, formDat
|
||||
// ignore
|
||||
}
|
||||
|
||||
redirect(`/login?message=password_changed&callbackUrl=/${slug}/dashboard`)
|
||||
return {
|
||||
success: true,
|
||||
error: '',
|
||||
redirectTo: `/login?message=password_changed&callbackUrl=/dashboard`,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user