add password change functionality with frontend integration

This commit is contained in:
2025-09-03 14:50:35 +02:00
parent a24b2697b0
commit 68f13f369c
4 changed files with 72 additions and 0 deletions

View File

@@ -413,3 +413,16 @@ export const changeUserPassword = async (username, newPassword) => {
if (result.affectedRows > 0) return { success: true };
return { success: false };
};
export const changeUserPasswordFRONTEND = async (
username,
oldPassword,
newPassword
) => {
const [result] = await pool.query(
"UPDATE users SET password = ? WHERE username = ? AND password = ?",
[newPassword, username, oldPassword]
);
if (result.affectedRows > 0) return { success: true };
return { success: false };
};