From dd29c7324fb0308893da43ac24415bac9e641ebf Mon Sep 17 00:00:00 2001 From: Joel Thomas Date: Mon, 1 Jun 2026 17:40:27 +0530 Subject: [PATCH] Fix: Prevent duplicate usernames across all user states Changes: - Updated username duplicate validation to consider all existing users. - Prevented reuse of usernames belonging to deleted/disabled accounts. - Fixed authentication conflicts caused by duplicate usernames. Fixes #1809 --- .../Trenser.VehicleServiceSystem/utilities/Validator.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp index f56d660..e8968d9 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp @@ -116,15 +116,13 @@ bool util::isPasswordValid(const std::string& password) * usersMap - map of user objects keyed by identifier * Returns: * bool - true if the username is already in use by an active user, false otherwise - * Notes: - * - Only considers users with state util::State::ACTIVE */ bool util::isUsernameDuplicate(const std::string& username, const util::Map& usersMap) { int index = usersMap.findIf( [&](const std::string&, User* user) { - return (user->getUserName() == username && user->getState() == util::State::ACTIVE); + return (user->getUserName() == username); } ); return index != -1;