Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloud-filelink.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <oparoz@users.noreply.github.com>2017-03-30 20:51:58 +0300
committerGitHub <noreply@github.com>2017-03-30 20:51:58 +0300
commit30c1b0e51406c7dd6cac5765e39a0437dfc3ffbf (patch)
tree6ec86a79f752e2dc91dba2b1a4d2a7bc54dbd6ba
parent19403f30f9f2ffaa8659151e8f6ffecc004d55bc (diff)
parent2b14046e033943a779a0dcc33a42b8166c12b0a5 (diff)
Merge pull request #6 from nextcloud/allow-to-use-an-app-token
Allow to login with an app token
-rw-r--r--src/components/nsNextcloud.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/components/nsNextcloud.js b/src/components/nsNextcloud.js
index 269337a..02e16d7 100644
--- a/src/components/nsNextcloud.js
+++ b/src/components/nsNextcloud.js
@@ -37,7 +37,7 @@ Cu.import("resource:///modules/gloda/log4moz.js");
Cu.import("resource:///modules/cloudFileAccounts.js");
const kRestBase = "/ocs/v1.php";
-const kAuthPath = kRestBase + "/person/check";
+const kAuthPath = kRestBase + "/cloud/user";
const kShareApp = kRestBase + "/apps/files_sharing/api/v1/shares";
const kMaxFileSize = 1073741824;
const kWebDavPath = "/remote.php/webdav";
@@ -190,7 +190,7 @@ Nextcloud.prototype = {
if (!this._loggedIn) {
return this._logonAndGetUserInfo(successCallback, null, true);
}
-
+
this.log.info("getting user info");
if (!this._userInfo) {
@@ -398,16 +398,14 @@ Nextcloud.prototype = {
this.log.info("Sending login information...");
- let username = "login=" + wwwFormUrlEncode(this._userName);
- let password = "&password=" + wwwFormUrlEncode(this._password);
- let loginData = username + password;
let args = "?format=json";
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
- req.open("POST", this._serverUrl + ":" + this._serverPort + kAuthPath + args, true);
+ req.open("GET", this._serverUrl + ":" + this._serverPort + kAuthPath + args, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.setRequestHeader("OCS-APIREQUEST", "true");
+ req.setRequestHeader("Authorization", "Basic " + btoa(this._userName + ':' + this._password));
req.onerror = function () {
this.log.info("logon failure");
@@ -447,7 +445,7 @@ Nextcloud.prototype = {
}
}.bind(this);
- req.send(loginData);
+ req.send();
this.log.info("Login information sent!");
},