mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Remove code that is unneeded for the moment
This commit is contained in:
parent
6c9b92400e
commit
8198574087
@ -103,70 +103,6 @@ MultiWikiClientAdaptor.prototype.getStatus = function(callback) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Attempt to login and invoke the callback(err)
|
|
||||||
*/
|
|
||||||
MultiWikiClientAdaptor.prototype.login = function(username,password,callback) {
|
|
||||||
var options = {
|
|
||||||
url: this.host + "challenge/tiddlywebplugins.tiddlyspace.cookie_form",
|
|
||||||
type: "POST",
|
|
||||||
data: {
|
|
||||||
user: username,
|
|
||||||
password: password,
|
|
||||||
tiddlyweb_redirect: "/status" // workaround to marginalize automatic subsequent GET
|
|
||||||
},
|
|
||||||
callback: function(err) {
|
|
||||||
callback(err);
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
"accept": "application/json",
|
|
||||||
"X-Requested-With": "TiddlyWiki"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.logger.log("Logging in:",options);
|
|
||||||
$tw.utils.httpRequest(options);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
MultiWikiClientAdaptor.prototype.logout = function(callback) {
|
|
||||||
if(this.logoutIsAvailable) {
|
|
||||||
var options = {
|
|
||||||
url: this.host + "logout",
|
|
||||||
type: "POST",
|
|
||||||
data: {
|
|
||||||
csrf_token: this.getCsrfToken(),
|
|
||||||
tiddlyweb_redirect: "/status" // workaround to marginalize automatic subsequent GET
|
|
||||||
},
|
|
||||||
callback: function(err,data,xhr) {
|
|
||||||
callback(err);
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
"accept": "application/json",
|
|
||||||
"X-Requested-With": "TiddlyWiki"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.logger.log("Logging out:",options);
|
|
||||||
$tw.utils.httpRequest(options);
|
|
||||||
} else {
|
|
||||||
alert("This server does not support logging out. If you are using basic authentication the only way to logout is close all browser windows");
|
|
||||||
callback(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Retrieve the CSRF token from its cookie
|
|
||||||
*/
|
|
||||||
MultiWikiClientAdaptor.prototype.getCsrfToken = function() {
|
|
||||||
var regex = /^(?:.*; )?csrf_token=([^(;|$)]*)(?:;|$)/,
|
|
||||||
match = regex.exec(document.cookie),
|
|
||||||
csrf = null;
|
|
||||||
if (match && (match.length === 2)) {
|
|
||||||
csrf = match[1];
|
|
||||||
}
|
|
||||||
return csrf;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get details of changed tiddlers from the server
|
Get details of changed tiddlers from the server
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user