[Pkg-owncloud-commits] [owncloud-client] 100/219: owncloudcmd: ask for the login and password and put it in the url (if it's not there already)

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 278bc5a8cddb769db813060b07d27348995c9669
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Mon Sep 15 13:24:31 2014 +0200

    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
---
 src/owncloudcmd/owncloudcmd.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index 543717b..c957552 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;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list