Send a http post request for validating login (bug 390815)

This commit is contained in:
zach@zachlipton.com 2007-08-03 10:40:33 -07:00
parent f23a8dc1c5
commit 9cc1318074
2 changed files with 16 additions and 6 deletions

View File

@ -107,6 +107,17 @@ var qaTools = {
alert(e);
}
},
httpPostRequest : function (url, data, callback, errback) {
// do a xmlhttprequest sending data with the post method
var req = getXMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", data.length);
req.setRequestHeader("Connection", "close");
req = sendXMLHttpRequest(req, data);
req.addErrback(errback);
req.addCallback(callback);
},
showHideLoadingMessage : function(box, bool) {
if (bool == true) { // show
var loading = document.createElementNS("http://www.w3.org/1999/xhtml", "p");

View File

@ -130,13 +130,12 @@
},
validateLogin : function(uname, passwd, callback) {
var req = doSimpleXMLHttpRequest(litmus.baseURL+'json.cgi', {
validate_login: 1,
username: uname,
password: passwd
var qs = queryString({
validate_login: 1,
username: uname,
password: passwd
});
req.addErrback(callback);
req.addCallback(callback);
qaTools.httpPostRequest(litmus.baseURL+'json.cgi', qs, callback);
},
createAccount : function() {
alert("XXX: not implemented");