From 9021d4bbf0795cae601fe2bd656e15ae63f97e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 4 Sep 2020 20:31:41 +0200 Subject: [PATCH] QAuthenticator: Don't assume cached credentials are new Although this is more of a QNAM thing. In some cases what we load from the cache might be credentials we have already tried (and failed with, thus leading us to emit the authenticationRequired signal). With this patch we will fall through more often and ask the user for credentials. Pick-to: 5.15 Change-Id: If2a556883c3ea5b0b225f4df273d38353b552b54 Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkaccessmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b82864c52e..4d6bc58b00 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1519,7 +1519,8 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authen } QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedCredentials(url, authenticator); - if (!cred.isNull()) { + if (!cred.isNull() + && (cred.user != authenticator->user() || cred.password != authenticator->password())) { authenticator->setUser(cred.user); authenticator->setPassword(cred.password); *urlForLastAuthentication = url;