Merge pull request #949 from 190km/fix-edit-password

fix(settings/profile): edit profile password fixed
This commit is contained in:
Mauricio Siu
2024-12-20 23:17:07 -06:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -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");

View File

@@ -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 || input.password) {
const correctPassword = bcrypt.compareSync(
input.password,
input.currentPassword || "",
currentAuth?.password || "",
);
if (!correctPassword) {