@@ -37,7 +37,7 @@ Cu.import("resource:///modules/gloda/log4moz.js");
3737Cu . import ( "resource:///modules/cloudFileAccounts.js" ) ;
3838
3939const kRestBase = "/ocs/v1.php" ;
40- const kAuthPath = kRestBase + "/person/check " ;
40+ const kAuthPath = kRestBase + "/cloud/user " ;
4141const kShareApp = kRestBase + "/apps/files_sharing/api/v1/shares" ;
4242const kMaxFileSize = 1073741824 ;
4343const kWebDavPath = "/remote.php/webdav" ;
@@ -190,7 +190,7 @@ Nextcloud.prototype = {
190190 if ( ! this . _loggedIn ) {
191191 return this . _logonAndGetUserInfo ( successCallback , null , true ) ;
192192 }
193-
193+
194194 this . log . info ( "getting user info" ) ;
195195
196196 if ( ! this . _userInfo ) {
@@ -398,16 +398,14 @@ Nextcloud.prototype = {
398398
399399 this . log . info ( "Sending login information..." ) ;
400400
401- let username = "login=" + wwwFormUrlEncode ( this . _userName ) ;
402- let password = "&password=" + wwwFormUrlEncode ( this . _password ) ;
403- let loginData = username + password ;
404401 let args = "?format=json" ;
405402 let req = Cc [ "@mozilla.org/xmlextras/xmlhttprequest;1" ]
406403 . createInstance ( Ci . nsIXMLHttpRequest ) ;
407404
408- req . open ( "POST " , this . _serverUrl + ":" + this . _serverPort + kAuthPath + args , true ) ;
405+ req . open ( "GET " , this . _serverUrl + ":" + this . _serverPort + kAuthPath + args , true ) ;
409406 req . setRequestHeader ( "Content-Type" , "application/x-www-form-urlencoded" ) ;
410407 req . setRequestHeader ( "OCS-APIREQUEST" , "true" ) ;
408+ req . setRequestHeader ( "Authorization" , "Basic " + btoa ( this . _userName + ':' + this . _password ) ) ;
411409
412410 req . onerror = function ( ) {
413411 this . log . info ( "logon failure" ) ;
@@ -447,7 +445,7 @@ Nextcloud.prototype = {
447445 }
448446 } . bind ( this ) ;
449447
450- req . send ( loginData ) ;
448+ req . send ( ) ;
451449 this . log . info ( "Login information sent!" ) ;
452450 } ,
453451
0 commit comments