mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 16:44:48 -07:00
Add ability to ban by client id
This commit is contained in:
parent
26e63a9a3a
commit
b102a05a36
17 changed files with 114 additions and 24 deletions
|
|
@ -14,4 +14,5 @@ message Command_BanFromServer {
|
|||
optional uint32 minutes = 3;
|
||||
optional string reason = 4;
|
||||
optional string visible_reason = 5;
|
||||
optional string clientid = 6;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,5 @@ message ServerInfo_User {
|
|||
optional uint64 session_id = 10;
|
||||
optional uint64 accountage_secs = 11;
|
||||
optional string email = 12;
|
||||
optional string clientid = 13;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ message Command_Register {
|
|||
// Country code of the user. 2 letter ISO format
|
||||
optional string country = 5;
|
||||
optional string real_name = 6;
|
||||
optional string clientid = 7;
|
||||
}
|
||||
|
||||
// User wants to activate an account
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
|
|||
|
||||
QWriteLocker locker(&clientsLock);
|
||||
|
||||
AuthenticationResult authState = databaseInterface->checkUserPassword(session, name, password, reasonStr, secondsLeft);
|
||||
AuthenticationResult authState = databaseInterface->checkUserPassword(session, name, password, clientid, reasonStr, secondsLeft);
|
||||
if (authState == NotLoggedIn || authState == UserIsBanned || authState == UsernameInvalid || authState == UserIsInactive)
|
||||
return authState;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ public:
|
|||
Server_DatabaseInterface(QObject *parent = 0)
|
||||
: QObject(parent) { }
|
||||
|
||||
virtual AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, QString &reasonStr, int &secondsLeft) = 0;
|
||||
virtual bool checkUserIsBanned(const QString & /* ipAddress */, const QString & /* userName */, QString & /* banReason */, int & /* banSecondsRemaining */) { return false; }
|
||||
virtual AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, const QString &clientId, QString &reasonStr, int &secondsLeft) = 0;
|
||||
virtual bool checkUserIsBanned(const QString & /* ipAddress */, const QString & /* userName */, const QString & /* clientId */, QString & /* banReason */, int & /* banSecondsRemaining */) { return false; }
|
||||
virtual bool activeUserExists(const QString & /* user */) { return false; }
|
||||
virtual bool userExists(const QString & /* user */) { return false; }
|
||||
virtual QMap<QString, ServerInfo_User> getBuddyList(const QString & /* name */) { return QMap<QString, ServerInfo_User>(); }
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ ServerInfo_User &ServerInfo_User_Container::copyUserInfo(ServerInfo_User &result
|
|||
if (!sessionInfo) {
|
||||
result.clear_session_id();
|
||||
result.clear_address();
|
||||
result.clear_clientid();
|
||||
}
|
||||
if (!internalInfo)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue