bug fix
This commit is contained in:
parent
9938d21499
commit
9a28552af5
|
@ -21,10 +21,11 @@ export default async function deleteUserById(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then, we check if the provided password matches the one stored in the database
|
// Then, we check if the provided password matches the one stored in the database (disabled in Keycloak integration)
|
||||||
|
if (!process.env.KEYCLOAK_CLIENT_SECRET) {
|
||||||
const isPasswordValid = bcrypt.compareSync(
|
const isPasswordValid = bcrypt.compareSync(
|
||||||
body.password,
|
body.password,
|
||||||
user.password || ""
|
user.password as string
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isPasswordValid) {
|
if (!isPasswordValid) {
|
||||||
|
@ -33,6 +34,7 @@ export default async function deleteUserById(
|
||||||
status: 401, // Unauthorized
|
status: 401, // Unauthorized
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the user and all related data within a transaction
|
// Delete the user and all related data within a transaction
|
||||||
await prisma
|
await prisma
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default function Password() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (password == "") {
|
if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED !== "true" && password == "") {
|
||||||
return toast.error("Please fill the required fields.");
|
return toast.error("Please fill the required fields.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ export default function Password() {
|
||||||
. This action is irreversible!
|
. This action is irreversible!
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED !== "true" ? (
|
||||||
<div>
|
<div>
|
||||||
<p className="mb-2 text-black dark:text-white">
|
<p className="mb-2 text-black dark:text-white">
|
||||||
Confirm Your Password
|
Confirm Your Password
|
||||||
|
@ -90,6 +91,7 @@ export default function Password() {
|
||||||
type="password"
|
type="password"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
) : undefined}
|
||||||
|
|
||||||
{process.env.NEXT_PUBLIC_STRIPE ? (
|
{process.env.NEXT_PUBLIC_STRIPE ? (
|
||||||
<fieldset className="border rounded-md p-2 border-sky-500">
|
<fieldset className="border rounded-md p-2 border-sky-500">
|
||||||
|
|
Ŝarĝante…
Reference in New Issue