mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
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:
@@ -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}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user