Do not create users entry in getPassword

This commit is contained in:
HanzZ 2011-08-24 00:18:51 +02:00
parent 751c1c2457
commit 87c8752bc1
3 changed files with 4 additions and 5 deletions

View file

@ -102,6 +102,7 @@ class UserRegistry : public Swift::UserRegistry {
mutable std::map<std::string, Sess> users;
mutable Config *config;
std::string empty;
};
}

View file

@ -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");

View file

@ -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;
}
}