mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-22 12:56:37 +00:00
generate 2fa backup codes
This commit is contained in:
@@ -5,7 +5,7 @@ import { fromError } from "zod-validation-error";
|
||||
import { unauthorized } from "@server/auth";
|
||||
import { z } from "zod";
|
||||
import { db } from "@server/db";
|
||||
import { User, users } from "@server/db/schema";
|
||||
import { twoFactorBackupCodes, User, users } from "@server/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { response } from "@server/utils";
|
||||
import { verifyPassword } from "./password";
|
||||
@@ -82,6 +82,10 @@ export async function disable2fa(
|
||||
.set({ twoFactorEnabled: false })
|
||||
.where(eq(users.id, user.id));
|
||||
|
||||
await db
|
||||
.delete(twoFactorBackupCodes)
|
||||
.where(eq(twoFactorBackupCodes.userId, user.id));
|
||||
|
||||
return response<null>(res, {
|
||||
data: null,
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user