/* Protected Slots */ void LoginWindow::attemptLogin() { qDebug("LoginWindow::attemptLogin"); QString username = usernameField->text(); QByteArray password; password.append(passwordField->text()); this->setButtonsEnabled( false ); errorLabel->setText( tr("Please Wait...") ); if ( username.isEmpty() ) { QSettings settings; QString md5FromIni = settings.value("node/password").toString(); if ( ! md5FromIni.isEmpty() ) { /* Check for shutdown password */ QString passwordMd5 = QString(QCryptographicHash::hash(password,QCryptographicHash::Md5).toHex()); qDebug() << "Password: "******"Hashed Password: "******"Hash from INI file: " << md5FromIni; if ( passwordMd5 == md5FromIni ) { /* Shut it down */ qDebug() << "Shutdown password matches, exiting."; #ifdef Q_OS_WIN // If this is an MS Windows platform, use the keylocker programs to limit mischief. QProcess::startDetached("windows/on_login.exe"); #endif exit(1); } } } emit attemptLogin( username, password ); }
ViewLoading::ViewLoading(QWidget* parent) : ViewBase(parent) { ui.setupUi(this); const FCPlayerModel* pPlayerModel = FCAPP->playerModel(); QObject::connect(this, SIGNAL(attemptLogin(QString, QString)), pPlayerModel, SLOT(onLogin(QString, QString))); QObject::connect(FCAPP, SIGNAL(serverInfoReceived(unsigned char, unsigned char)), this, SLOT(onServerInfoReceived(unsigned char, unsigned char))); }
void LoginWindow::setupActions() { qDebug("LoginWindow::setupActions"); connect(loginButton, SIGNAL(clicked()), this, SLOT(attemptLogin())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(resetLoginScreen())); }
void ViewLoading::openLoginDialog() { // Allow the user to attempt to login. Cancelling the login will quit the client DlgLogin* pLogin = new DlgLogin(this); int nResult = pLogin->exec(); if ( nResult == QDialog::Accepted) { addLogItem( ResourceManager::instance().getClientString( STR_LOGIN_ATTEMPTING ) ); emit attemptLogin( pLogin->getUsername(), pLogin->getPassword() ); } else { // we need to shutdown FCAPP->quit(); } }
void YOGLoginScreen::handleYOGClientEvent(boost::shared_ptr<YOGClientEvent> event) { //std::cout<<"YOGLoginScreen: recieved event "<<event->format()<<std::endl; Uint8 type = event->getEventType(); if(type == YEConnected) { attemptLogin(); } else if(type == YEConnectionLost) { //shared_ptr<YOGConnectionLostEvent> info = static_pointer_cast<YOGConnectionLostEvent>(event); animation->visible=false; statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_LOST]")); } else if(type == YELoginAccepted) { //shared_ptr<YOGLoginAcceptedEvent> info = static_pointer_cast<YOGLoginAcceptedEvent>(event); animation->visible=false; runLobby(); } else if(type == YELoginRefused) { shared_ptr<YOGLoginRefusedEvent> info = static_pointer_cast<YOGLoginRefusedEvent>(event); animation->visible=false; YOGLoginState reason = info->getReason(); if(reason == YOGPasswordIncorrect) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_BAD_PASSWORD]")); } else if(reason == YOGUsernameAlreadyUsed) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_ALREADY_PASSWORD]")); } else if(reason == YOGUserNotRegistered) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO]")); } else if(reason == YOGClientVersionTooOld) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD]")); } else if(reason == YOGAlreadyAuthenticated) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED]")); } else if(reason == YOGUsernameBanned) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_BANNED]")); } else if(reason == YOGIPAddressBanned) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED]")); } else if(reason == YOGNameInvalidSpecialCharacters) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_INVALID_SPECIAL_CHARACTERS]")); } else if(reason == YOGLoginUnknown) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_UNEXPLAINED]")); } client->disconnect(); } }