diff --git a/servatrice/servatrice.sql b/servatrice/servatrice.sql index 0f41a127..7c7dda60 100644 --- a/servatrice/servatrice.sql +++ b/servatrice/servatrice.sql @@ -109,6 +109,7 @@ CREATE TABLE IF NOT EXISTS `cockatrice_users` ( `avatar_bmp` blob NOT NULL, `registrationDate` datetime NOT NULL, `active` tinyint(1) NOT NULL, + `banned` tinyint(1) NOT NULL, `token` char(32) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) diff --git a/servatrice/src/servatrice.cpp b/servatrice/src/servatrice.cpp index 9684c634..b3d532cc 100644 --- a/servatrice/src/servatrice.cpp +++ b/servatrice/src/servatrice.cpp @@ -152,13 +152,15 @@ AuthenticationResult Servatrice::checkUserPassword(const QString &user, const QS checkSql(); QSqlQuery query; - query.prepare("select password from " + dbPrefix + "_users where name = :name and active = 1"); + query.prepare("select banned, password from " + dbPrefix + "_users where name = :name and active = 1"); query.bindValue(":name", user); if (!execSqlQuery(query)) return PasswordWrong; if (query.next()) { - if (query.value(0).toString() == password) + if (query.value(0).toInt()) + return PasswordWrong; + if (query.value(1).toString() == password) return PasswordRight; else return PasswordWrong;