From a4552a159607944d753c46bae583017b10b0dade Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Wed, 23 Feb 2011 23:07:18 +0100 Subject: [PATCH] added permban to sql structure --- servatrice/servatrice.sql | 1 + servatrice/src/servatrice.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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;