Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

bug fix

daniel31x139a28552af54b
diff --git a/lib/api/controllers/users/userId/deleteUserById.ts b/lib/api/controllers/users/userId/deleteUserById.ts
index 91c507cd..c32b1fb3 100644
--- a/lib/api/controllers/users/userId/deleteUserById.ts
+++ b/lib/api/controllers/users/userId/deleteUserById.ts
@@ -21,17 +21,19 @@ export default async function deleteUserById(
};
}
- // Then, we check if the provided password matches the one stored in the database
- const isPasswordValid = bcrypt.compareSync(
- body.password,
- user.password || ""
- );
-
- if (!isPasswordValid) {
- return {
- response: "Invalid credentials.",
- status: 401, // Unauthorized
- };
+ // 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(
+ body.password,
+ user.password as string
+ );
+
+ if (!isPasswordValid) {
+ return {
+ response: "Invalid credentials.",
+ status: 401, // Unauthorized
+ };
+ }
}
// Delete the user and all related data within a transaction
diff --git a/pages/settings/delete.tsx b/pages/settings/delete.tsx
index a9014006..3718c61b 100644
--- a/pages/settings/delete.tsx
+++ b/pages/settings/delete.tsx
@@ -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.");
}
@@ -78,18 +78,20 @@ export default function Password() {
. This action is irreversible!
</p>
- <div>
- <p className="mb-2 text-black dark:text-white">
- Confirm Your Password
- </p>
-
- <TextInput
- value={password}
- onChange={(e) => setPassword(e.target.value)}
- placeholder="••••••••••••••"
- type="password"
- />
- </div>
+ {process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED !== "true" ? (
+ <div>
+ <p className="mb-2 text-black dark:text-white">
+ Confirm Your Password
+ </p>
+
+ <TextInput
+ value={password}
+ onChange={(e) => setPassword(e.target.value)}
+ placeholder="••••••••••••••"
+ type="password"
+ />
+ </div>
+ ) : undefined}
{process.env.NEXT_PUBLIC_STRIPE ? (
<fieldset className="border rounded-md p-2 border-sky-500">