mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
setup wizard: use a PROPFIND instead of a GET on the webdav url
In order to initiate the conneciton, we should not send a GET on the webdav URL because that is not a valid webdav command on a collection. Issue #2911
This commit is contained in:
parent
f913cd97ee
commit
4d85f1daec
3 changed files with 6 additions and 35 deletions
|
@ -211,9 +211,11 @@ void OwncloudSetupWizard::testOwnCloudConnect()
|
|||
{
|
||||
AccountPtr account = _ocWizard->account();
|
||||
|
||||
ValidateDavAuthJob *job = new ValidateDavAuthJob(account, this);
|
||||
auto *job = new PropfindJob(account, "/", this);
|
||||
job->setIgnoreCredentialFailure(true);
|
||||
connect(job, SIGNAL(authResult(QNetworkReply*)), SLOT(slotConnectionCheck(QNetworkReply*)));
|
||||
job->setProperties(QList<QByteArray>() << "getlastmodified");
|
||||
connect(job, SIGNAL(result(QVariantMap)), _ocWizard, SLOT(successfulStep()));
|
||||
connect(job, SIGNAL(networkError(QNetworkReply*)), this, SLOT(slotConnectionCheck(QNetworkReply*)));
|
||||
job->start();
|
||||
}
|
||||
|
||||
|
@ -249,7 +251,7 @@ void OwncloudSetupWizard::slotConnectionCheck(QNetworkReply* reply)
|
|||
_ocWizard->successfulStep();
|
||||
break;
|
||||
default:
|
||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 403) {
|
||||
if (!_ocWizard->account()->credentials()->stillValid(reply)) {
|
||||
msg = tr("Access forbidden by server. To verify that you have proper access, "
|
||||
"<a href=\"%1\">click here</a> to access the service with your browser.")
|
||||
.arg(_ocWizard->account()->url().toString());
|
||||
|
@ -534,24 +536,4 @@ bool DetermineAuthTypeJob::finished()
|
|||
return true;
|
||||
}
|
||||
|
||||
ValidateDavAuthJob::ValidateDavAuthJob(AccountPtr account, QObject *parent)
|
||||
: AbstractNetworkJob(account, QString(), parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ValidateDavAuthJob::start()
|
||||
{
|
||||
QString p = account()->davPath();
|
||||
QNetworkReply *reply = getRequest(p);
|
||||
setReply(reply);
|
||||
setupConnections(reply);
|
||||
AbstractNetworkJob::start();
|
||||
}
|
||||
|
||||
bool ValidateDavAuthJob::finished()
|
||||
{
|
||||
emit authResult(reply());
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace OCC
|
||||
|
|
|
@ -31,17 +31,6 @@ namespace OCC {
|
|||
|
||||
class OwncloudWizard;
|
||||
|
||||
class ValidateDavAuthJob : public AbstractNetworkJob {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ValidateDavAuthJob(AccountPtr account, QObject *parent = 0);
|
||||
void start() Q_DECL_OVERRIDE;
|
||||
signals:
|
||||
void authResult(QNetworkReply*);
|
||||
private slots:
|
||||
bool finished() Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
class DetermineAuthTypeJob : public AbstractNetworkJob {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
void setMultipleFoldersExist( bool );
|
||||
void setConfigExists( bool );
|
||||
bool configExists();
|
||||
void successfulStep();
|
||||
AbstractCredentials* getCredentials() const;
|
||||
|
||||
void raiseCertificatePopup();
|
||||
|
@ -72,6 +71,7 @@ public slots:
|
|||
void setRemoteFolder( const QString& );
|
||||
void appendToConfigurationLog( const QString& msg, LogType type = LogParagraph );
|
||||
void slotCurrentPageChanged( int );
|
||||
void successfulStep();
|
||||
|
||||
signals:
|
||||
void clearPendingRequests();
|
||||
|
|
Loading…
Reference in a new issue