mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
Added server side setting to allow the requirement of a client id from clients.
This commit is contained in:
parent
95cc10a278
commit
b62ffdeb0b
8 changed files with 18 additions and 5 deletions
|
|
@ -35,7 +35,7 @@ message Response {
|
|||
RespActivationAccepted = 31; // Server accepted a reg user activation token
|
||||
RespActivationFailed = 32; // Server didn't accept a reg user activation token
|
||||
RespRegistrationAcceptedNeedsActivation = 33; // Server accepted cient registration, but it will need token activation
|
||||
RespClientIDRequired = 34; // Server requires client to generate and send its client id before allowing access
|
||||
RespClientIdRequired = 34; // Server requires client to generate and send its client id before allowing access
|
||||
}
|
||||
enum ResponseType {
|
||||
JOIN_ROOM = 1000;
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
|
|||
|
||||
if (clientid.isEmpty()){
|
||||
// client id is empty, either out dated client or client has been modified
|
||||
if (getClientIdRequired())
|
||||
return ClientIdRequired;
|
||||
}
|
||||
else {
|
||||
// update users database table with client id
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class GameEventContainer;
|
|||
class CommandContainer;
|
||||
class Command_JoinGame;
|
||||
|
||||
enum AuthenticationResult { NotLoggedIn, PasswordRight, UnknownUser, WouldOverwriteOldSession, UserIsBanned, UsernameInvalid, RegistrationRequired, UserIsInactive };
|
||||
enum AuthenticationResult { NotLoggedIn, PasswordRight, UnknownUser, WouldOverwriteOldSession, UserIsBanned, UsernameInvalid, RegistrationRequired, UserIsInactive, ClientIdRequired };
|
||||
|
||||
class Server : public QObject
|
||||
{
|
||||
|
|
@ -56,6 +56,7 @@ public:
|
|||
virtual QString getLoginMessage() const { return QString(); }
|
||||
|
||||
virtual bool getGameShouldPing() const { return false; }
|
||||
virtual bool getClientIdRequired() const { return false; }
|
||||
virtual int getPingClockInterval() const { return 0; }
|
||||
virtual int getMaxGameInactivityTime() const { return 9999999; }
|
||||
virtual int getMaxPlayerInactivityTime() const { return 9999999; }
|
||||
|
|
|
|||
|
|
@ -409,6 +409,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
|
|||
return Response::RespUsernameInvalid;
|
||||
}
|
||||
case RegistrationRequired: return Response::RespRegistrationRequired;
|
||||
case ClientIdRequired: return Response::RespClientIdRequired;
|
||||
case UserIsInactive: return Response::RespAccountNotActivated;
|
||||
default: authState = res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue