Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
a4552a15
Commit
a4552a15
authored
Feb 23, 2011
by
Max-Wilhelm Bruker
Browse files
added permban to sql structure
parent
06fe9eec
Changes
2
Hide whitespace changes
Inline
Side-by-side
servatrice/servatrice.sql
View file @
a4552a15
...
...
@@ -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`
)
...
...
servatrice/src/servatrice.cpp
View file @
a4552a15
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment