fix: correct req.user property from id to userId in controllers
This commit is contained in:
@@ -254,7 +254,7 @@ export async function deleteUser(
|
||||
}
|
||||
|
||||
// Prevent admin from deleting themselves
|
||||
if (req.user?.id === userId) {
|
||||
if (req.user?.userId === userId) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Cannot deactivate your own account',
|
||||
@@ -305,7 +305,7 @@ export async function changePassword(
|
||||
}
|
||||
|
||||
// Only allow users to change their own password
|
||||
if (req.user?.id !== userId) {
|
||||
if (req.user?.userId !== userId) {
|
||||
res.status(403).json({
|
||||
success: false,
|
||||
error: 'You can only change your own password',
|
||||
|
||||
Reference in New Issue
Block a user