enable modifying profile settings for SSO users

This commit is contained in:
daniel31x13
2024-05-12 22:28:34 -04:00
parent 861f8e55f4
commit 65b29830f0
4 changed files with 117 additions and 152 deletions
@@ -25,16 +25,20 @@ export default async function deleteUserById(
};
}
// Then, we check if the provided password matches the one stored in the database (disabled in SSO/OAuth integrations)
if (user.password && !isServerAdmin) {
console.log("isServerAdmin", isServerAdmin);
console.log("isServerAdmin", body.password);
const isPasswordValid = bcrypt.compareSync(
body.password,
user.password as string
);
if (!isServerAdmin) {
if (user.password) {
const isPasswordValid = bcrypt.compareSync(
body.password,
user.password as string
);
if (!isPasswordValid && !isServerAdmin) {
if (!isPasswordValid && !isServerAdmin) {
return {
response: "Invalid credentials.",
status: 401, // Unauthorized
};
}
} else {
return {
response: "Invalid credentials.",
status: 401, // Unauthorized