added 2FA

This commit is contained in:
2024-04-26 22:16:21 +03:00
parent 53cadc289a
commit f17a002ac6
38 changed files with 1036 additions and 414 deletions

View File

@@ -1,9 +1,13 @@
'use server'
import db from '@/lib/db'
import journal from '@/actions/logger'
export const getVerificationTokenByToken = async (token: string) => {
try {
return await db.verificationToken.findUnique({ where: { token } })
} catch {
} catch (err) {
journal.error({ getVerificationTokenByToken: err, token })
return null
}
}
@@ -11,7 +15,18 @@ export const getVerificationTokenByToken = async (token: string) => {
export const getVerificationTokenByEmail = async (email: string) => {
try {
return await db.verificationToken.findFirst({ where: { email } })
} catch {
} catch (err) {
journal.error({ getVerificationTokenByEmail: err, email })
return null
}
}
export const deleteVerificationToken = async (id: string) => {
try {
await db.verificationToken.delete({
where: { id },
})
} catch (err) {
journal.error({ deleteVerificationToken: err, id })
}
}