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 <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2020-09-04 20:31:41 +02:00
parent 2c7152ba09
commit 9021d4bbf0

View File

@ -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;