Fix servatrice's regonly mode

This commit is contained in:
Fabio Bas 2014-10-06 22:56:09 +02:00
parent faa66e4d7f
commit 15555c16fd
5 changed files with 12 additions and 5 deletions

View file

@ -136,7 +136,7 @@ bool Servatrice::initServer()
{
serverName = settingsCache->value("server/name", "My Cockatrice server").toString();
serverId = settingsCache->value("server/id", 0).toInt();
bool regServerOnly = settingsCache->value("server/regonly", 0).toBool();
bool regServerOnly = settingsCache->value("authentication/regonly", 0).toBool();
const QString authenticationMethodStr = settingsCache->value("authentication/method").toString();
if (authenticationMethodStr == "sql") {

View file

@ -89,6 +89,11 @@ bool Servatrice_DatabaseInterface::usernameIsValid(const QString &user)
return (result.size() > 0);
}
bool Servatrice_DatabaseInterface::getRequireRegistration()
{
return settingsCache->value("authentication/regonly", 0).toBool();
}
AuthenticationResult Servatrice_DatabaseInterface::checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, QString &reasonStr, int &banSecondsLeft)
{
switch (server->getAuthenticationMethod()) {

View file

@ -50,7 +50,8 @@ public:
void lockSessionTables();
void unlockSessionTables();
bool userSessionExists(const QString &userName);
bool getRequireRegistration();
};
#endif