Initial release of client ID generation.

This commit is contained in:
woogerboy21
2015-08-05 10:15:49 -04:00
parent 44d757f691
commit 52db13a1ca
14 changed files with 246 additions and 186 deletions

View File

@@ -103,7 +103,7 @@ Server_DatabaseInterface *Server::getDatabaseInterface() const
return databaseInterfaces.value(QThread::currentThread());
}
AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reasonStr, int &secondsLeft)
AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reasonStr, int &secondsLeft, QString &clientid)
{
if (name.size() > 35)
name = name.left(35);
@@ -123,6 +123,8 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
databaseInterface->lockSessionTables();
if (authState == PasswordRight) {
// verify that new session would not cause problems with older existing session
if (users.contains(name) || databaseInterface->userSessionExists(name)) {
qDebug("Login denied: would overwrite old session");
databaseInterface->unlockSessionTables();
@@ -168,6 +170,15 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
event.mutable_user_info()->CopyFrom(session->copyUserInfo(true, true, true));
locker.unlock();
// check if client id exists (older client compatibility)
if (clientid.isEmpty()){
// client id is empty, either out dated client or client has been modified
}
else {
// update users database table with client id
databaseInterface->updateUsersClientID(name, clientid);
}
se = Server_ProtocolHandler::prepareSessionEvent(event);
sendIsl_SessionEvent(*se);
delete se;