mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
* migrate to cmake * move the 3rd party libs * organize 3rdparty * update the 3rd party version * refine the CMakeLists.txt * update install command * update install command * update install command * update install command * update dependency * update the dependency * update the dependency * remove CPM.cmake * remove QtCreator project file * update cmake file * improve cmake file * add cmakew * use wget * remove echo * update the doc * remove the screenshot * update the doc * update the install steps * check the openconnect version * update the doc * update install scripts * fix install scripts * improve message * improve message * improve install scripts * improve the version check * improve the version check * improve install script * add version * organize includes * add version bump * update CI * update CI * add the release flag * update message
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
#include <QtCore/QUrlQuery>
|
|
|
|
#include "loginparams.h"
|
|
|
|
LoginParams::LoginParams(const QString clientos)
|
|
{
|
|
params.addQueryItem("prot", QUrl::toPercentEncoding("https:"));
|
|
params.addQueryItem("server", "");
|
|
params.addQueryItem("inputSrc", "");
|
|
params.addQueryItem("jnlpReady", "jnlpReady");
|
|
params.addQueryItem("user", "");
|
|
params.addQueryItem("passwd", "");
|
|
params.addQueryItem("computer", QUrl::toPercentEncoding(QSysInfo::machineHostName()));
|
|
params.addQueryItem("ok", "Login");
|
|
params.addQueryItem("direct", "yes");
|
|
params.addQueryItem("clientVer", "4100");
|
|
params.addQueryItem("os-version", QUrl::toPercentEncoding(QSysInfo::prettyProductName()));
|
|
|
|
// add the clientos parameter if not empty
|
|
if (!clientos.isEmpty()) {
|
|
params.addQueryItem("clientos", clientos);
|
|
}
|
|
|
|
params.addQueryItem("portal-userauthcookie", "");
|
|
params.addQueryItem("portal-prelogonuserauthcookie", "");
|
|
params.addQueryItem("prelogin-cookie", "");
|
|
params.addQueryItem("ipv6-support", "yes");
|
|
}
|
|
|
|
LoginParams::~LoginParams()
|
|
{
|
|
}
|
|
|
|
void LoginParams::setUser(const QString user)
|
|
{
|
|
updateQueryItem("user", user);
|
|
}
|
|
|
|
void LoginParams::setServer(const QString server)
|
|
{
|
|
updateQueryItem("server", server);
|
|
}
|
|
|
|
void LoginParams::setPassword(const QString password)
|
|
{
|
|
updateQueryItem("passwd", password);
|
|
}
|
|
|
|
void LoginParams::setUserAuthCookie(const QString cookie)
|
|
{
|
|
updateQueryItem("portal-userauthcookie", cookie);
|
|
}
|
|
|
|
void LoginParams::setPrelogonAuthCookie(const QString cookie)
|
|
{
|
|
updateQueryItem("portal-prelogonuserauthcookie", cookie);
|
|
}
|
|
|
|
void LoginParams::setPreloginCookie(const QString cookie)
|
|
{
|
|
updateQueryItem("prelogin-cookie", cookie);
|
|
}
|
|
|
|
QByteArray LoginParams::toUtf8() const
|
|
{
|
|
return params.toString().toUtf8();
|
|
}
|
|
|
|
void LoginParams::updateQueryItem(const QString key, const QString value)
|
|
{
|
|
if (params.hasQueryItem(key)) {
|
|
params.removeQueryItem(key);
|
|
}
|
|
params.addQueryItem(key, QUrl::toPercentEncoding(value));
|
|
}
|