diff --git a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp index 689f70f7..d4549595 100644 --- a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp +++ b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp @@ -60,17 +60,7 @@ void internetGameLoginDialogImpl::accept() { if(groupBox_reguser->isChecked()) { myConfig->writeConfigInt("InternetLoginMode", 0); - if(checkBox_guest->isChecked()) { - // Generate a valid guest name. - QString guestName; - int guestId; - Tools::getRandNumber(1, 99999, 1, &guestId, false); - guestName.sprintf("Guest%05d", guestId); - myConfig->writeConfigString("MyName", guestName.toUtf8().constData()); - } - else { - myConfig->writeConfigString("MyName", lineEdit_username->text().toUtf8().constData()); - } + myConfig->writeConfigString("MyName", lineEdit_username->text().toUtf8().constData()); if(checkBox_rememberPassword->isChecked()) { myConfig->writeConfigInt("InternetSavePassword", 1); myConfig->writeConfigString("InternetLoginPassword", lineEdit_password->text().toUtf8().toBase64().constData()); @@ -79,8 +69,14 @@ void internetGameLoginDialogImpl::accept() { myConfig->writeConfigInt("InternetSavePassword", 0); } } - else { + else if(checkBox_guest->isChecked()) { myConfig->writeConfigInt("InternetLoginMode", 1); + // Generate a valid guest name. + QString guestName; + int guestId; + Tools::getRandNumber(1, 99999, 1, &guestId, false); + guestName.sprintf("Guest%05d", guestId); + myConfig->writeConfigString("MyName", guestName.toUtf8().constData()); } myConfig->writeBuffer(); diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index aa668525..f6ba867c 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -959,7 +959,10 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage } } if (!validGuest) + { SessionError(session, ERR_NET_INVALID_PLAYER_NAME); + return; + } } #ifdef POKERTH_OFFICIAL_SERVER else if (initMessage.login.present == login_PR_authenticatedLogin) @@ -983,7 +986,10 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage } #endif else + { SessionError(session, ERR_NET_INVALID_PASSWORD); + return; + } // Check whether the player name is correct. // Partly, this is also done in netpacket.