Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e0e57c00d8 | |||
| a3061f4749 | |||
| bb2fa84316 | |||
| f02017ceef | |||
| 35efedc481 | |||
| 6f02f1db44 |
@@ -116,13 +116,15 @@ 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<std::string, User*>& usersMap)
|
||||
{
|
||||
int index = usersMap.findIf(
|
||||
[&](const std::string&, User* user)
|
||||
{
|
||||
return (user->getUserName() == username);
|
||||
return (user->getUserName() == username && user->getState() == util::State::ACTIVE);
|
||||
}
|
||||
);
|
||||
return index != -1;
|
||||
|
||||
Reference in New Issue
Block a user