Ejemplo n.º 1
0
void sbbs_t::badlogin(char* user, char* passwd)
{
	char reason[128];
	ulong count;

	SAFEPRINTF(reason,"%s LOGIN", connection);
	count=loginFailure(startup->login_attempt_list, &client_addr, connection, user, passwd);
	if(startup->login_attempt_hack_threshold && count>=startup->login_attempt_hack_threshold)
		::hacklog(&cfg, reason, user, passwd, client_name, &client_addr);
	if(startup->login_attempt_filter_threshold && count>=startup->login_attempt_filter_threshold)
		filter_ip(&cfg, connection, "- TOO MANY CONSECUTIVE FAILED LOGIN ATTEMPTS"
			,client_name, client_ipaddr, user, /* fname: */NULL);

	mswait(startup->login_attempt_delay);
}
Ejemplo n.º 2
0
void GagBookManager::onLoginFinished()
{
    if(m_loginReply->error() == QNetworkReply::NoError) {
        const int statusCode = m_loginReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
        const QUrl redirectUrl = m_loginReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        // if redirect to 9gag.com, means login success
        if (statusCode >= 300 && statusCode < 400 && redirectUrl.host() == "9gag.com") {
            m_settings->setLoggedIn(true);
            emit loginSuccess();
        } else {
            emit loginFailure("Wrong username or password. Please try again.");
        }
    } else {
        emit loginFailure(m_loginReply->errorString());
    }

    m_loginReply->deleteLater();
    m_loginReply = 0;

    if (m_isBusy != false) {
        m_isBusy = false;
        emit busyChanged();
    }
}
Ejemplo n.º 3
0
void PlayerSetupDialog::setCurrentPlayer(PlayerConnection* con)
{
    if(con == m_con)
        return;

    m_stickyConnectionMessage = false;
    if(m_con)
    {
        disconnect(ui->playerName, 0, m_con, 0);
        disconnect(ui->playerHost, 0, m_con, 0);
        disconnect(ui->playerUser, 0, m_con, 0);
        disconnect(ui->playerPass, 0, m_con, 0);
        disconnect(m_con, 0, this, 0);
    }

    if(m_subviewModel)
    {
        delete m_subviewModel;
        m_subviewModel = 0;
    }

    m_con = con;

    if(!con)
    {
        ui->boxConnection->setEnabled(false);
        ui->boxOutput->setEnabled(false);
        ui->boxSubviewOpts->setEnabled(false);
        ui->boxSubviews->setEnabled(false);
        ui->boxKeystone->setEnabled(true);
        return;
    }

    if(con->isConnected())
        conConnected();
    else
        conDisconnected();

    // Set up the UI with values from the player before connecting slots so we dont needlessly update the object
    ui->playerName->setText(con->name());
    ui->playerHost->setText(con->host());
    ui->playerUser->setText(con->user());
    ui->playerPass->setText(con->pass());
    ui->autoconnectBox->setChecked(con->autoconnect());
    ui->optIgnoreAR->setChecked(con->aspectRatioMode() == Qt::IgnoreAspectRatio);

    QRect screen = con->screenRect();
    if(screen.isEmpty())
        con->setScreenRect(screen = QRect(0,0,1024,768));
    ui->outputX->setValue(screen.x());
    ui->outputY->setValue(screen.y());
    ui->outputWidth->setValue(screen.width());
    ui->outputHeight->setValue(screen.height());

    QRect view = con->viewportRect();
    if(view.isEmpty())
        con->setViewportRect(view = QRect(0,0,1000,750));
    ui->viewportX->setValue(view.x());
    ui->viewportY->setValue(view.y());
    ui->viewportWidth->setValue(view.width());
    ui->viewportHeight->setValue(view.height());

    connect(ui->playerName, SIGNAL(textChanged(QString)), con, SLOT(setName(QString)));
    connect(ui->playerHost, SIGNAL(textChanged(QString)), con, SLOT(setHost(QString)));
    connect(ui->playerUser, SIGNAL(textChanged(QString)), con, SLOT(setUser(QString)));
    connect(ui->playerPass, SIGNAL(textChanged(QString)), con, SLOT(setPass(QString)));

    connect(con, SIGNAL(connected()), this, SLOT(conConnected()));
    connect(con, SIGNAL(disconnected()), this, SLOT(conDisconnected()));
    connect(con, SIGNAL(loginSuccess()), this, SLOT(conLoginSuccess()));
    connect(con, SIGNAL(loginFailure()), this, SLOT(conLoginFailure()));
    connect(con, SIGNAL(playerError(QString)), this, SLOT(conPlayerError(QString)));
    connect(con, SIGNAL(pingResponseReceived(QString)), this, SLOT(conPingResponseReceived(QString)));
    connect(con, SIGNAL(testStarted()), this, SLOT(conTestStarted()));
    connect(con, SIGNAL(testEnded()), this, SLOT(conTestEnded()));
    connect(con, SIGNAL(testResults(bool)), this, SLOT(conTestResults(bool)));

    ui->boxConnection->setEnabled(true);
    ui->boxOutput->setEnabled(true);

    m_subviewModel = new PlayerSubviewsModel(con);

    ui->subviewListview->setModel(m_subviewModel);
    ui->subviewListview->setCurrentIndex(m_subviewModel->index(0,0));

    GLWidgetSubview *sub = !con->subviews().isEmpty() ? con->subviews().at(0) : 0;
    if(!sub)
        con->addSubview(sub = new GLWidgetSubview());
    if(sub->title().isEmpty())
        sub->setTitle("Default Subview");

    setCurrentSubview(sub);
}