mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Add first draft of protocol extension for registration
Stub for registration command handling in server First draft of handling registration requests WIP (will be rebased) clean up bad imports (rebase this later) Finish checkUserIsBanned method Add username validity check Check servatrice registration settings WIP Finish(?) server side of registration Needs testing Fix switch case compile failure I have no idea why I have to do this WIP for registration testing python script Stub register script initial attempt Rearrange register script First try at sending reg register.py sends commands correctly now Add more debug to register.py Pack bytes the right way - servatrice can parse py script sends now register.py should be working now Parse xml hack correctly Log registration enabled settings on server start Insert gender correctly on register Show tcpserver error message on failed gameserver listen Fail startup if db configured and can't be opened. TIL qt5 comes without mysql by default in homebrew...
This commit is contained in:
parent
d1b243481b
commit
735fcbf311
16 changed files with 394 additions and 48 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <QObject>
|
||||
#include <QSqlDatabase>
|
||||
#include <QHash>
|
||||
#include <qchar.h>
|
||||
|
||||
#include "server.h"
|
||||
#include "server_database_interface.h"
|
||||
|
|
@ -18,15 +19,22 @@ private:
|
|||
QHash<QString, QSqlQuery *> preparedStatements;
|
||||
Servatrice *server;
|
||||
ServerInfo_User evalUserQueryResult(const QSqlQuery *query, bool complete, bool withId = false);
|
||||
bool usernameIsValid(const QString &user);
|
||||
/** Must be called after checkSql and server is known to be in auth mode. */
|
||||
bool checkUserIsIpBanned(const QString &ipAddress, QString &banReason, int &banSecondsRemaining);
|
||||
/** Must be called after checkSql and server is known to be in auth mode. */
|
||||
bool checkUserIsNameBanned(QString const &userName, QString &banReason, int &banSecondsRemaining);
|
||||
QChar getGenderChar(ServerInfo_User_Gender const &gender);
|
||||
protected:
|
||||
bool usernameIsValid(const QString &user);
|
||||
AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, QString &reasonStr, int &secondsLeft);
|
||||
bool checkUserIsBanned(const QString &ipAddress, const QString &userName, QString &banReason, int &banSecondsRemaining);
|
||||
public slots:
|
||||
void initDatabase(const QSqlDatabase &_sqlDatabase);
|
||||
public:
|
||||
Servatrice_DatabaseInterface(int _instanceId, Servatrice *_server);
|
||||
~Servatrice_DatabaseInterface();
|
||||
void initDatabase(const QString &type, const QString &hostName, const QString &databaseName, const QString &userName, const QString &password);
|
||||
bool initDatabase(const QString &type, const QString &hostName, const QString &databaseName,
|
||||
const QString &userName, const QString &password);
|
||||
bool openDatabase();
|
||||
bool checkSql();
|
||||
QSqlQuery * prepareQuery(const QString &queryText);
|
||||
|
|
@ -55,6 +63,7 @@ public:
|
|||
bool userSessionExists(const QString &userName);
|
||||
|
||||
bool getRequireRegistration();
|
||||
bool registerUser(const QString &userName, const QString &realName, ServerInfo_User_Gender const &gender, const QString &passwordSha512, const QString &emailAddress, const QString &country, bool active = false);
|
||||
|
||||
void logMessage(const int senderId, const QString &senderName, const QString &senderIp, const QString &logMessage, LogMessage_TargetType targetType, const int targetId, const QString &targetName);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue