refactor: update reset password and authentication flows

This commit removes several authentication-related components and simplifies the password reset process:

- Removed login-2fa component
- Deleted confirm-email page
- Updated reset password logic to use Drizzle ORM directly
- Removed unused authentication-related functions
- Simplified server-side authentication routes
This commit is contained in:
Mauricio Siu
2025-02-22 21:09:21 -06:00
parent 8ab6d6b282
commit b00c12965a
14 changed files with 214 additions and 404 deletions

View File

@@ -108,6 +108,23 @@ export const isAdminPresent = async () => {
return true;
};
export const findAdmin = async () => {
const admin = await db.query.member.findFirst({
where: eq(member.role, "owner"),
with: {
user: true,
},
});
if (!admin) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Admin not found",
});
}
return admin;
};
export const getUserByToken = async (token: string) => {
const user = await db.query.invitation.findFirst({
where: eq(invitation.id, token),
@@ -154,8 +171,8 @@ export const getDokployUrl = async () => {
}
const admin = await findAdmin();
if (admin.host) {
return `https://${admin.host}`;
if (admin.user.host) {
return `https://${admin.user.host}`;
}
return `http://${admin.serverIp}:${process.env.PORT}`;
return `http://${admin.user.serverIp}:${process.env.PORT}`;
};