// much more likely, so keep trying to connect.
setState(NetworkError);
break;
- case ConnectionValidator::CredentialsWrong:
- account()->handleInvalidCredentials();
+ case ConnectionValidator::CredentialsMissingOrWrong:
+ slotInvalidCredentials();
break;
case ConnectionValidator::UserCanceledCredentials:
setState(SignedOut);
void AccountState::slotInvalidCredentials()
{
- if (isSignedOut()) {
+ if (isSignedOut() || _waitingForNewCredentials)
return;
- }
+
+ if (account()->credentials()->ready())
+ account()->credentials()->invalidateToken();
+ account()->credentials()->fetchFromKeychain();
setState(ConfigurationError);
_waitingForNewCredentials = true;
void Account::handleInvalidCredentials()
{
- // invalidate & forget token/password
- // but try to re-sign in.
- if (_credentials->ready()) {
- _credentials->invalidateAndFetch();
- } else {
- _credentials->fetch();
- }
-
emit invalidCredentials();
}
return QLatin1String("NotConfigured");
case ServerVersionMismatch:
return QLatin1String("Server Version Mismatch");
- case CredentialsWrong:
+ case CredentialsMissingOrWrong:
return QLatin1String("Credentials Wrong");
case StatusNotFound:
return QLatin1String("Status not found");
}
// now check the authentication
- AbstractCredentials *creds = _account->credentials();
- if (creds->ready()) {
+ if (_account->credentials()->ready())
QTimer::singleShot( 0, this, SLOT( checkAuthentication() ));
- } else {
- // We can't proceed with the auth check because we don't have credentials.
- // Fetch them now! Once fetched, a new connectivity check will be
- // initiated anyway.
- creds->fetch(_credentialsFetchMode);
-
- // no result is reported
- deleteLater();
- }
+ else
+ reportResult( CredentialsMissingOrWrong );
}
// status.php could not be loaded (network or server issue!).
qDebug() << reply->error() << reply->errorString();
qDebug() << "******** Password is wrong!";
_errors << tr("The provided credentials are not correct");
- stat = CredentialsWrong;
+ stat = CredentialsMissingOrWrong;
} else if( reply->error() != QNetworkReply::NoError ) {
_errors << errorMessage(reply->errorString(), reply->readAll());
|
+-> slotJobTimeout --> X
|
- +-> slotStatusFound
- credential->fetch() --+
- |
- +-----------------------------------+
+ +-> slotStatusFound --+--> X (if credentials are still missing)
+ |
+ +---------------------------+
|
*-+-> checkAuthentication (PROPFIND on root)
PropfindJob
virtual void persist() = 0;
/** Invalidates auth token, or password for basic auth */
virtual void invalidateToken() = 0;
- void invalidateAndFetch() {
- invalidateToken();
- fetch();
- }
-
static QString keychainKey(const QString &url, const QString &user);