From e034de9083b5cb73fcd134188ec9c8f1bc887a08 Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Sun, 9 May 2021 00:12:05 +0200 Subject: [PATCH] don't log in users while giving them an error for missing the clientid (#4335) --- common/server.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/server.cpp b/common/server.cpp index 401ce5f3..75538c3a 100644 --- a/common/server.cpp +++ b/common/server.cpp @@ -85,6 +85,15 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString &clientVersion, QString & /* connectionType */) { + bool hasClientId = false; + if (clientid.isEmpty()) { + // client id is empty, either out dated client or client has been modified + if (getClientIDRequiredEnabled()) + return ClientIdRequired; + } else { + hasClientId = true; + } + if (name.size() > 35) name = name.left(35); @@ -164,15 +173,10 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, event.mutable_user_info()->CopyFrom(session->copyUserInfo(true, true, true)); locker.unlock(); - if (clientid.isEmpty()) { - // client id is empty, either out dated client or client has been modified - if (getClientIDRequiredEnabled()) - return ClientIdRequired; - } else { + if (hasClientId) { // update users database table with client id databaseInterface->updateUsersClientID(name, clientid); } - databaseInterface->updateUsersLastLoginData(name, clientVersion); se = Server_ProtocolHandler::prepareSessionEvent(event); sendIsl_SessionEvent(*se);