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
0d9eec4b
Commit
0d9eec4b
authored
Oct 04, 2014
by
Fabio Bas
Browse files
Servatrice: added authentication type "password"
parent
0261862b
Changes
3
Hide whitespace changes
Inline
Side-by-side
servatrice/src/servatrice.cpp
View file @
0d9eec4b
...
...
@@ -141,9 +141,11 @@ bool Servatrice::initServer()
const
QString
authenticationMethodStr
=
settingsCache
->
value
(
"authentication/method"
).
toString
();
if
(
authenticationMethodStr
==
"sql"
)
{
authenticationMethod
=
AuthenticationSql
;
}
else
if
(
authenticationMethodStr
==
"password"
)
{
authenticationMethod
=
AuthenticationPassword
;
}
else
{
if
(
regServerOnly
)
{
qDebug
()
<<
"Registration only server enabled but no
DB Connection
: Error."
;
qDebug
()
<<
"Registration only server enabled but no
authentication method defined
: Error."
;
return
false
;
}
authenticationMethod
=
AuthenticationNone
;
...
...
servatrice/src/servatrice.h
View file @
0d9eec4b
...
...
@@ -88,7 +88,7 @@ class Servatrice : public Server
{
Q_OBJECT
public:
enum
AuthenticationMethod
{
AuthenticationNone
,
AuthenticationSql
};
enum
AuthenticationMethod
{
AuthenticationNone
,
AuthenticationSql
,
AuthenticationPassword
};
private
slots
:
void
statusUpdate
();
void
shutdownTimeout
();
...
...
servatrice/src/servatrice_database_interface.cpp
View file @
0d9eec4b
...
...
@@ -2,6 +2,7 @@
#include
"servatrice_database_interface.h"
#include
"passwordhasher.h"
#include
"serversocketinterface.h"
#include
"settingscache.h"
#include
"decklist.h"
#include
"pb/game_replay.pb.h"
#include
<QDebug>
...
...
@@ -92,6 +93,13 @@ AuthenticationResult Servatrice_DatabaseInterface::checkUserPassword(Server_Prot
{
switch
(
server
->
getAuthenticationMethod
())
{
case
Servatrice
::
AuthenticationNone
:
return
UnknownUser
;
case
Servatrice
::
AuthenticationPassword
:
{
QString
configPassword
=
settingsCache
->
value
(
"authentication/password"
).
toString
();
if
(
configPassword
==
password
)
return
PasswordRight
;
return
NotLoggedIn
;
}
case
Servatrice
::
AuthenticationSql
:
{
if
(
!
checkSql
())
return
UnknownUser
;
...
...
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