mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
[OAuth] Fix lock
This commit is contained in:
parent
8202eb91b2
commit
c0b3e6d9d4
@ -125,14 +125,14 @@ QNetworkReply *AbstractNetworkJob::addTimer(QNetworkReply *reply)
|
||||
return reply;
|
||||
}
|
||||
|
||||
bool AbstractNetworkJob::retryAble() const
|
||||
bool AbstractNetworkJob::isAuthenticationJob() const
|
||||
{
|
||||
return _retryAble;
|
||||
return _isAuthenticationJob;
|
||||
}
|
||||
|
||||
void AbstractNetworkJob::setRetryAble(bool retryAble)
|
||||
void AbstractNetworkJob::setAuthenticationJob(bool b)
|
||||
{
|
||||
_retryAble = retryAble;
|
||||
_isAuthenticationJob = b;
|
||||
}
|
||||
|
||||
QNetworkReply *AbstractNetworkJob::sendRequest(const QByteArray &verb, const QUrl &url,
|
||||
@ -205,8 +205,7 @@ void AbstractNetworkJob::slotFinished()
|
||||
}
|
||||
|
||||
if (_reply->error() != QNetworkReply::NoError) {
|
||||
|
||||
if (retryAble() && _account->credentials()->retryIfNeeded(this))
|
||||
if (!isAuthenticationJob() && _account->credentials()->retryIfNeeded(this))
|
||||
return;
|
||||
|
||||
if (!_ignoreCredentialFailure || _reply->error() != QNetworkReply::AuthenticationRequiredError) {
|
||||
|
||||
@ -98,9 +98,9 @@ public:
|
||||
*/
|
||||
static int httpTimeout;
|
||||
|
||||
/** whether or noth this job can be retried */
|
||||
bool retryAble() const;
|
||||
void setRetryAble(bool retryAble);
|
||||
/** whether or noth this job should be restarted after authentication */
|
||||
bool isAuthenticationJob() const;
|
||||
void setAuthenticationJob(bool b);
|
||||
|
||||
public slots:
|
||||
void setTimeout(qint64 msec);
|
||||
@ -207,7 +207,7 @@ private:
|
||||
// Reparented to the currently running QNetworkReply.
|
||||
QPointer<QIODevice> _requestBody;
|
||||
|
||||
bool _retryAble = true;
|
||||
bool _isAuthenticationJob = false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -249,7 +249,7 @@ SimpleNetworkJob *OAuth::postTokenRequest(const QList<QPair<QString, QString>> &
|
||||
|
||||
auto job = _account->sendRequest("POST", requestTokenUrl, req, requestBody);
|
||||
job->setTimeout(qMin(30 * 1000ll, job->timeoutMsec()));
|
||||
job->setRetryAble(false);
|
||||
job->setAuthenticationJob(true);
|
||||
return job;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user