Do not create users entry in getPassword
This commit is contained in:
parent
751c1c2457
commit
87c8752bc1
3 changed files with 4 additions and 5 deletions
|
@ -102,6 +102,7 @@ class UserRegistry : public Swift::UserRegistry {
|
|||
|
||||
mutable std::map<std::string, Sess> users;
|
||||
mutable Config *config;
|
||||
std::string empty;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue