added permban to sql structure

This commit is contained in:
Max-Wilhelm Bruker 2011-02-23 23:07:18 +01:00
parent 06fe9eec26
commit a4552a1596
2 changed files with 5 additions and 2 deletions

View file

@ -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`)

View file

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