Changeset View
Changeset View
Standalone View
Standalone View
resources/openxchange/oxa/connectiontestjob.cpp
Show All 30 Lines | |||||
31 | { | 31 | { | ||
32 | } | 32 | } | ||
33 | 33 | | |||
34 | void ConnectionTestJob::start() | 34 | void ConnectionTestJob::start() | ||
35 | { | 35 | { | ||
36 | if (!mUrl.startsWith(QStringLiteral("https://"))) { | 36 | if (!mUrl.startsWith(QStringLiteral("https://"))) { | ||
37 | mUrl = QStringLiteral("https://") + mUrl; | 37 | mUrl = QStringLiteral("https://") + mUrl; | ||
38 | } | 38 | } | ||
39 | const QUrl url(mUrl + QStringLiteral("/ajax/login?action=login&name=%1&password=%2").arg(mUser, mPassword)); | 39 | const QUrl url(mUrl + QStringLiteral("/ajax/login?action=login&name=%1").arg(mUser)); | ||
40 | 40 | | |||
41 | KJob *job = KIO::storedGet(url, KIO::Reload, KIO::HideProgressInfo); | 41 | const QByteArray data = QStringLiteral("password=%1").arg(mPassword).toUtf8(); | ||
42 | KIO::StoredTransferJob *job = KIO::storedHttpPost(data, url, KIO::HideProgressInfo); | ||||
43 | job->addMetaData(QStringLiteral("content-type"), QStringLiteral("application/x-www-form-urlencoded")); | ||||
42 | connect(job, &KJob::result, this, &ConnectionTestJob::httpJobFinished); | 44 | connect(job, &KJob::result, this, &ConnectionTestJob::httpJobFinished); | ||
43 | } | 45 | } | ||
44 | 46 | | |||
45 | void ConnectionTestJob::httpJobFinished(KJob *job) | 47 | void ConnectionTestJob::httpJobFinished(KJob *job) | ||
46 | { | 48 | { | ||
47 | if (job->error()) { | 49 | if (job->error()) { | ||
48 | setError(job->error()); | 50 | setError(job->error()); | ||
49 | setErrorText(job->errorText()); | 51 | setErrorText(job->errorText()); | ||
Show All 31 Lines |