1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-06 22:04:19 +00:00

Proper TiddlyWeb login

This commit is contained in:
Jeremy Ruston 2012-11-16 22:59:33 +00:00
parent 447496a6f8
commit 6c1eb7500d

View File

@ -32,7 +32,13 @@ exports.startup = function() {
// Get the login status // Get the login status
$tw.plugins.tiddlyweb.getStatus(function(isLoggedIn,json) { $tw.plugins.tiddlyweb.getStatus(function(isLoggedIn,json) {
if(!isLoggedIn) { if(!isLoggedIn) {
// $tw.plugins.tiddlyweb.login(username,password); $tw.passwordPrompt.createPrompt({
serviceName: "Login to TiddlySpace",
callback: function(data) {
$tw.plugins.tiddlyweb.login(data.username,data.password);
return true; // Get rid of the password prompt
}
});
} }
}); });
}; };
@ -138,7 +144,6 @@ $tw.plugins.tiddlyweb.httpRequest = function(options) {
} }
client.onreadystatechange = function() { client.onreadystatechange = function() {
if(this.readyState === 4) { if(this.readyState === 4) {
console.log("onreadystatechange",this.status,this.statusText,this.getAllResponseHeaders());
if(this.status === 200) { if(this.status === 200) {
// success! // success!
options.callback(null,this.responseText); options.callback(null,this.responseText);