Fix password verification logic in UserService

Corrects the password verification by comparing the provided old password with the user's actual stored password instead of the new password.
dev-pending-01-01-2026
Naeem Ullah 4 weeks ago
parent 5e85a32f61
commit 44707f34c2

@ -50,7 +50,7 @@ public class UserService {
User user = userRepository.findById(request.getUserId())
.orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId()));
boolean isPasswordValid = PasswordEncryptionService.verifyPassword(request.getOldPassword(), request.getNewPassword());
boolean isPasswordValid = PasswordEncryptionService.verifyPassword(request.getOldPassword(), user.getPassword());
if(!isPasswordValid) {
throw new OldPasswordNotMatch(request.getPorOrgacode());
}

Loading…
Cancel
Save