Fix TokenCredentials compilation

This commit is contained in:
Olivier Goffart 2015-02-11 17:33:55 +01:00
parent 7e211ef3d9
commit 4f202e5f4c
3 changed files with 18 additions and 26 deletions

View file

@ -31,9 +31,10 @@ namespace CredentialsFactory
AbstractCredentials* create(const QString& type) AbstractCredentials* create(const QString& type)
{ {
#ifdef TOKEN_AUTH_ONLY #ifdef TOKEN_AUTH_ONLY
Q_UNUSED(type);
return new TokenCredentials; return new TokenCredentials;
#else #else
// empty string might happen for old version of configuration // empty string might happen for old version of configuration
if (type == "http" || type == "") { if (type == "http" || type == "") {
return new HttpCredentialsGui; return new HttpCredentialsGui;

View file

@ -165,11 +165,8 @@ bool TokenCredentials::ready() const
return _ready; return _ready;
} }
void TokenCredentials::fetch(Account *account) void TokenCredentials::fetch()
{ {
if( !account ) {
return;
}
Q_EMIT fetched(); Q_EMIT fetched();
} }
@ -181,22 +178,17 @@ bool TokenCredentials::stillValid(QNetworkReply *reply)
|| !reply->property(authenticationFailedC).toBool())); || !reply->property(authenticationFailedC).toBool()));
} }
QString TokenCredentials::queryPassword(bool *ok) void TokenCredentials::invalidateToken()
{
return QString();
}
void TokenCredentials::invalidateToken(Account *account)
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
_ready = false; _ready = false;
account->clearCookieJar(); _account->clearCookieJar();
_token = QString(); _token = QString();
_user = QString(); _user = QString();
_password = QString(); _password = QString();
} }
void TokenCredentials::persist(Account *account) void TokenCredentials::persist()
{ {
} }

View file

@ -40,20 +40,19 @@ public:
TokenCredentials(); TokenCredentials();
TokenCredentials(const QString& user, const QString& password, const QString &token); TokenCredentials(const QString& user, const QString& password, const QString &token);
void syncContextPreInit(CSYNC* ctx); void syncContextPreInit(CSYNC* ctx) Q_DECL_OVERRIDE;
void syncContextPreStart(CSYNC* ctx); void syncContextPreStart(CSYNC* ctx) Q_DECL_OVERRIDE;
bool changed(AbstractCredentials* credentials) const; bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
QString authType() const; QString authType() const Q_DECL_OVERRIDE;
QNetworkAccessManager* getQNAM() const; QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
bool ready() const; bool ready() const Q_DECL_OVERRIDE;
void fetch(); void fetch() Q_DECL_OVERRIDE;
bool stillValid(QNetworkReply *reply); bool stillValid(QNetworkReply *reply) Q_DECL_OVERRIDE;
void persist(); void persist() Q_DECL_OVERRIDE;
QString user() const; QString user() const Q_DECL_OVERRIDE;
QString password() const; void invalidateToken() Q_DECL_OVERRIDE;
QString queryPassword(bool *ok);
void invalidateToken();
QString password() const;
private Q_SLOTS: private Q_SLOTS:
void slotAuthentication(QNetworkReply*, QAuthenticator*); void slotAuthentication(QNetworkReply*, QAuthenticator*);