feat(scripts): add script to reset 2fa for admin

Similar style to existing reset-password script
This commit is contained in:
nikolajjsj 2025-06-22 15:10:57 +02:00
parent f35d084dd4
commit fa16cfec2a

27
apps/dokploy/reset-2fa.ts Normal file
View File

@ -0,0 +1,27 @@
import { findAdmin } from "@dokploy/server";
import { db } from "@dokploy/server/db";
import { users_temp } from "@dokploy/server/db/schema";
import { eq } from "drizzle-orm";
(async () => {
try {
const result = await findAdmin();
const update = await db
.update(users_temp)
.set({
twoFactorEnabled: false,
})
.where(eq(users_temp.id, result.userId));
if (update) {
console.log("2FA reset successful");
} else {
console.log("Password reset failed");
}
process.exit(0);
} catch (error) {
console.log("Error resetting 2FA", error);
}
})();