don't log in users while giving them an error for missing the clientid (#4335)

This commit is contained in:
ebbit1q 2021-05-09 00:12:05 +02:00 committed by GitHub
parent ecf57b4226
commit e034de9083
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,6 +85,15 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session,
QString &clientVersion, QString &clientVersion,
QString & /* connectionType */) 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) if (name.size() > 35)
name = name.left(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)); event.mutable_user_info()->CopyFrom(session->copyUserInfo(true, true, true));
locker.unlock(); locker.unlock();
if (clientid.isEmpty()) { if (hasClientId) {
// client id is empty, either out dated client or client has been modified
if (getClientIDRequiredEnabled())
return ClientIdRequired;
} else {
// update users database table with client id // update users database table with client id
databaseInterface->updateUsersClientID(name, clientid); databaseInterface->updateUsersClientID(name, clientid);
} }
databaseInterface->updateUsersLastLoginData(name, clientVersion); databaseInterface->updateUsersLastLoginData(name, clientVersion);
se = Server_ProtocolHandler::prepareSessionEvent(event); se = Server_ProtocolHandler::prepareSessionEvent(event);
sendIsl_SessionEvent(*se); sendIsl_SessionEvent(*se);