diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2014-09-15 15:24:31 +0400 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2014-09-15 15:24:31 +0400 |
commit | 278bc5a8cddb769db813060b07d27348995c9669 (patch) | |
tree | 76eb230b8766bd047cc3e69e078cfc4a1ad01919 /src/owncloudcmd | |
parent | 3c89415df16ba9785acb7cd0926adec3ac2c3efd (diff) |
owncloudcmd: ask for the login and password and put it in the url (if it's not there already)
Because we cannot rely on HTTPCredentials to open windows in a command line tool
Fixes #1860
Diffstat (limited to 'src/owncloudcmd')
-rw-r--r-- | src/owncloudcmd/owncloudcmd.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp index 543717be4..c95755240 100644 --- a/src/owncloudcmd/owncloudcmd.cpp +++ b/src/owncloudcmd/owncloudcmd.cpp @@ -146,6 +146,21 @@ int main(int argc, char **argv) { QUrl url(options.target_url.toUtf8()); + if (url.userName().isEmpty()) { + std::cout << "** Please enter the username:" << std::endl; + std::string s; + std::getline(std::cin, s); + url.setUserName(QString::fromStdString(s)); + } + if (url.password().isEmpty()) { + std::cout << "** Please enter the password:" << std::endl; + std::string s; + std::getline(std::cin, s); + url.setPassword(QString::fromStdString(s)); + } + + QUrl originalUrl = url; + Account account; // Find the folder and the original owncloud url @@ -165,7 +180,7 @@ restart_sync: CSYNC *_csync_ctx; if( csync_create( &_csync_ctx, options.source_dir.toUtf8(), - options.target_url.toUtf8()) < 0 ) { + originalUrl.toEncoded().constData()) < 0 ) { qFatal("Unable to create csync-context!"); return EXIT_FAILURE; } |