Skip to content

Commit 7a686dc

Browse files
committedNov 9, 2018
owncloudcmd: fix compiliation with TOKEN_AUTH_ONLY
1 parent 5c61939 commit 7a686dc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed
 

‎src/cmd/cmd.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828

2929
#include "account.h"
3030
#include "configfile.h" // ONLY ACCESS THE STATIC FUNCTIONS!
31-
#include "creds/httpcredentials.h"
31+
#ifdef TOKEN_AUTH_ONLY
32+
# include "creds/tokencredentials.h"
33+
#else
34+
# include "creds/httpcredentials.h"
35+
#endif
3236
#include "simplesslerrorhandler.h"
3337
#include "syncengine.h"
3438
#include "common/syncjournaldb.h"
@@ -130,6 +134,7 @@ QString queryPassword(const QString &user)
130134
return QString::fromStdString(s);
131135
}
132136

137+
#ifndef TOKEN_AUTH_ONLY
133138
class HttpCredentialsText : public HttpCredentials
134139
{
135140
public:
@@ -161,6 +166,7 @@ class HttpCredentialsText : public HttpCredentials
161166
private:
162167
bool _sslTrusted;
163168
};
169+
#endif /* TOKEN_AUTH_ONLY */
164170

165171
void help()
166172
{
@@ -451,13 +457,18 @@ int main(int argc, char **argv)
451457

452458
SimpleSslErrorHandler *sslErrorHandler = new SimpleSslErrorHandler;
453459

460+
#ifdef TOKEN_AUTH_ONLY
461+
TokenCredentials *cred = new TokenCredentials(user, password, "");
462+
account->setCredentials(cred);
463+
#else
454464
HttpCredentialsText *cred = new HttpCredentialsText(user, password);
455-
465+
account->setCredentials(cred);
456466
if (options.trustSSL) {
457467
cred->setSSLTrusted(true);
458468
}
469+
#endif
470+
459471
account->setUrl(url);
460-
account->setCredentials(cred);
461472
account->setSslErrorHandler(sslErrorHandler);
462473

463474
// Perform a call to get the capabilities.

0 commit comments

Comments
 (0)
Please sign in to comment.