webui: make login work

This commit is contained in:
electron128 2016-01-04 10:24:31 +01:00
parent c7cbd257a5
commit fd12b25cdd
3 changed files with 18 additions and 11 deletions

View File

@ -8,7 +8,11 @@ var currentpasswd = null;
var accountMap = new Map();
function login(){
alert("login:" + curraccount.location + "; passwort: " + currentpasswd);
//alert("login:" + curraccount.location + "; passwort: " + currentpasswd);
rs("control/login", {data: {id: curraccount.id}, callback:function(){
//alert("login send");
rs("control/password",{data: {password: currentpasswd}});
}});
}
function cancel(){

View File

@ -31,10 +31,6 @@ module.exports = {view: function(){
} else {
return m("div", "unknown runstate: " + runstate.runstate);
}
return m("div", peers.map(function(peer){
return m("div",peer.name)
}));
}
}
};

View File

@ -141,13 +141,20 @@ function rs(path, optionen){
schedule_request_missing();
}
return cache[path].data;
} else if (optionen.args != undefined) {
return m.request({
method: "GET",
} else{
m.request({
method: "POST",
url: api_url + path,
args: optionen.args,
background: false,
})();
data: optionen.data,
background: true,
}).then(function(){
// i'm not happy about this.
// wouldn't it be nicer to return the thennable to the caller?
// but it is not nice to return different things from the rs function
// maybe make anotehr function which returns thennables
if(optionen.callback)
optionen.callback();
});
}
}