From bf2551b0f613e1fe2186c88c011ec3da80eb29fc Mon Sep 17 00:00:00 2001 From: 190km Date: Fri, 20 Dec 2024 00:54:32 +0100 Subject: [PATCH 1/3] fix(settings/profile): fixed password changing --- apps/dokploy/server/api/routers/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/server/api/routers/auth.ts b/apps/dokploy/server/api/routers/auth.ts index ef9db4da2..cad77927c 100644 --- a/apps/dokploy/server/api/routers/auth.ts +++ b/apps/dokploy/server/api/routers/auth.ts @@ -188,9 +188,9 @@ export const authRouter = createTRPCRouter({ .mutation(async ({ ctx, input }) => { const currentAuth = await findAuthByEmail(ctx.user.email); - if (input.password) { + if (input.currentPassword) { const correctPassword = bcrypt.compareSync( - input.password, + input.currentPassword, currentAuth?.password || "", ); if (!correctPassword) { From fdfa92753252af5b828d6785f9dd2fe382927599 Mon Sep 17 00:00:00 2001 From: 190km Date: Fri, 20 Dec 2024 01:00:16 +0100 Subject: [PATCH 2/3] feat(settings/profile): reset password form after validating password change --- .../components/dashboard/settings/profile/profile-form.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx b/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx index 65ccff0e3..1141397f9 100644 --- a/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx +++ b/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx @@ -104,6 +104,7 @@ export const ProfileForm = () => { .then(async () => { await refetch(); toast.success("Profile Updated"); + form.reset(); }) .catch(() => { toast.error("Error to Update the profile"); From 788771c5eb74cda95d2e490dfe981ed56cd1e63c Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Fri, 20 Dec 2024 23:16:38 -0600 Subject: [PATCH 3/3] refactor: add password in validation --- apps/dokploy/server/api/routers/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/server/api/routers/auth.ts b/apps/dokploy/server/api/routers/auth.ts index cad77927c..f0d3b495b 100644 --- a/apps/dokploy/server/api/routers/auth.ts +++ b/apps/dokploy/server/api/routers/auth.ts @@ -188,9 +188,9 @@ export const authRouter = createTRPCRouter({ .mutation(async ({ ctx, input }) => { const currentAuth = await findAuthByEmail(ctx.user.email); - if (input.currentPassword) { + if (input.currentPassword || input.password) { const correctPassword = bcrypt.compareSync( - input.currentPassword, + input.currentPassword || "", currentAuth?.password || "", ); if (!correctPassword) {