src/lib/src/models/site.cpp
/**
 * Try to log into the website.
 *
 * @param force Whether to force login or not
 */
Try to log into the website.
@param force Whether to force login or not
Try to log into the website . @param force Whether to force login or not
void Site::login(bool force)
{
	if (!force && m_loggedIn == LoginStatus::Pending) {
		return;
	}
	if (!force && m_loggedIn != LoginStatus::Unknown) {
		emit loggedIn(this, LoginResult::Already);
		return;
	}
	if (!canTestLogin()) {
		emit loggedIn(this, LoginResult::Impossible);
		return;
	}
	log(QStringLiteral("[%1] Logging in...").arg(m_url), Logger::Info);
	if (force) {
		m_cookieJar->clear();
		m_cookieJar->insertCookies(m_cookies);
	}
	m_loggedIn = LoginStatus::Pending;
	connect(m_login, &Login::loggedIn, this, &Site::loginFinished);
	m_login->login();
}
void Site :: login ( bool force ) { if ( ! force && m_loggedIn == LoginStatus :: Pending ) { return ; } if ( ! force && m_loggedIn != LoginStatus :: Unknown ) { emit loggedIn ( this , LoginResult :: Already ) ; return ; } if ( ! canTestLogin ( ) ) { emit loggedIn ( this , LoginResult :: Impossible ) ; return ; } log ( QStringLiteral ( " " ) . arg ( m_url ) , Logger :: Info ) ; if ( force ) { m_cookieJar -> clear ( ) ; m_cookieJar -> insertCookies ( m_cookies ) ; } m_loggedIn = LoginStatus :: Pending ; connect ( m_login , & Login :: loggedIn , this , & Site :: loginFinished ) ; m_login -> login ( ) ; }
Try to log into the website.
Try to log into the website .
// Clear cookies if we want to force a re-login