Implementing guest login.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "internetgamelogindialogimpl.h"
|
||||
#include "configfile.h"
|
||||
#include <tools.h>
|
||||
#include <QtCore>
|
||||
|
||||
internetGameLoginDialogImpl::internetGameLoginDialogImpl(QWidget *parent, ConfigFile *c) :
|
||||
@@ -59,7 +60,17 @@ void internetGameLoginDialogImpl::accept() {
|
||||
|
||||
if(groupBox_reguser->isChecked()) {
|
||||
myConfig->writeConfigInt("InternetLoginMode", 0);
|
||||
myConfig->writeConfigString("MyName", lineEdit_username->text().toUtf8().constData());
|
||||
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());
|
||||
}
|
||||
if(checkBox_rememberPassword->isChecked()) {
|
||||
myConfig->writeConfigInt("InternetSavePassword", 1);
|
||||
myConfig->writeConfigString("InternetLoginPassword", lineEdit_password->text().toUtf8().toBase64().constData());
|
||||
|
||||
@@ -334,7 +334,7 @@ void startWindowImpl::callInternetGameLoginDialog() {
|
||||
if(myInternetGameLoginDialog->result() == QDialog::Accepted) {
|
||||
//send login infos
|
||||
mySession->setLogin(
|
||||
myInternetGameLoginDialog->lineEdit_username->text().toUtf8().constData(),
|
||||
myConfig->readConfigString("MyName"),
|
||||
myInternetGameLoginDialog->lineEdit_password->text().toUtf8().constData(),
|
||||
myInternetGameLoginDialog->checkBox_guest->isChecked());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user