diff --git a/include/transport/userregistry.h b/include/transport/userregistry.h index 63d14a1ece047328520c2843cb16b2ed00e1470c..5b92298586d0bbd86ebb994469d51030208a41ac 100644 --- a/include/transport/userregistry.h +++ b/include/transport/userregistry.h @@ -102,6 +102,7 @@ class UserRegistry : public Swift::UserRegistry { mutable std::map users; mutable Config *config; + std::string empty; }; } diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 67257792708f608345e19e3c78e8b908a1b27057..b47b962b80c7cee8fa18b3d6ec2602bba72bd2d9 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -164,10 +164,6 @@ void UserManager::handlePresence(Swift::Presence::ref presence) { res.password = m_userRegistry->getUserPassword(userkey); } - if (res.password.empty()) { - m_userRegistry->onPasswordInvalid(presence->getFrom()); - } - // Unregistered users are not able to login if (!registered) { LOG4CXX_WARN(logger, "Unregistered user " << userkey << " tried to login"); diff --git a/src/userregistry.cpp b/src/userregistry.cpp index bfdb8faf6d3f886eaf8e24921fec8ff29dacd4bc..c6287faf99854f712bb9b877550836bc9be67f14 100644 --- a/src/userregistry.cpp +++ b/src/userregistry.cpp @@ -117,7 +117,9 @@ void UserRegistry::onPasswordInvalid(const Swift::JID &user) { } const std::string &UserRegistry::getUserPassword(const std::string &barejid) { - return users[barejid].password; + if (users.find(barejid) != users.end()) + return users[barejid].password; + return empty; } }