void SlideShare::login()
{
    qDebug() << ">>>>>>>>> SlideShare::login()";
    QUrl *login = new QUrl(QString("http://www.slideshare.net/login"));
    QByteArray data;
    data.append(QString("user_login="******"&user_password=").append(password).toUtf8());

    QNetworkRequest request;
    request.setUrl(*login);

    reply = manager.post(request, data);
    connect(reply, SIGNAL(finished()), this, SLOT(afterLogin()));
}
Exemple #2
0
bool CWebUser::login(const IUserIdentity & identity, time_t duration) throw (CException)
{
	string id = identity.getId();
	TPersistentStateMap states = identity.getPersistentStates();
	if (beforeLogin(id, states, false)) {
		changeIdentity(id, identity.getName(), states);
		if (duration > 0) {
			if (allowAutoLogin) {
				saveToCookie(duration);
			} else {
				throw CException("allowAutoLogin must be set true in order to use cookie-based authentication.");
			}
		}
		afterLogin(false);
	}
	return !getIsGuest();
}
Exemple #3
0
void CWebUser::restoreFromCookie()
{
	CWebApplication * app = dynamic_cast<CWebApplication*>(Cws::app());
	CHttpCookie cookie = app->getRequest()->getCookies()[getStateKeyPrefix()];
	CWebUserState data = parseStateFromCookie(cookie);

	if (data.id.empty()) {
		return;
	}

	if (beforeLogin(data.id, data.states, true)) {
		changeIdentity(data.id, data.name, data.states);
		if (autoRenewCookie) {
			cookie.expire = time(0) + data.duration;
			app->getResponse()->addCookie(cookie);
		}
		afterLogin(true);
	}
}