Commit a4552a15 authored by Max-Wilhelm Bruker's avatar Max-Wilhelm Bruker
Browse files

added permban to sql structure

parent 06fe9eec
......@@ -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`)
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment