22 lines
589 B
TypeScript
22 lines
589 B
TypeScript
'use server'
|
|
|
|
import db from '@/lib/db'
|
|
import journal from '@/actions/logger'
|
|
|
|
export const getPasswordResetTokenByToken = async (token: string) => {
|
|
try {
|
|
return await db.passwordResetToken.findUnique({ where: { token } })
|
|
} catch (err) {
|
|
journal.error({ getPasswordResetTokenByToken: err, token })
|
|
return null
|
|
}
|
|
}
|
|
|
|
export const getPasswordResetTokenByEmail = async (email: string) => {
|
|
try {
|
|
return await db.passwordResetToken.findFirst({ where: { email } })
|
|
} catch (err) {
|
|
journal.error({ getPasswordResetTokenByEmail: err, email })
|
|
return null
|
|
}
|
|
} |