sogo/UI/WebServerResources/SOGoRootPage.js
Wolfgang Sourdeau 3391161a12 Monotone-Parent: 555ffbaeafab3a0a23649acb1714e47a78d35d81
Monotone-Revision: c7c2186348790bb64c08730ba255f908ac68cfa9

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-21T16:42:58
Monotone-Branch: ca.inverse.sogo
2007-11-21 16:42:58 +00:00

43 lines
1.2 KiB
JavaScript

function initLogin() {
var date = new Date();
date.setTime(date.getTime() - 86400000);
document.cookie = ("0xHIGHFLYxSOGo-0.9=discard; path=/"
+ "; expires=" + date.toGMTString());
var submit = $("submit");
Event.observe(submit, "click", onLoginClick);
var userName = $("userName");
userName.focus();
var image = $("preparedAnimation");
image.parentNode.removeChild(image);
}
function onLoginClick(event) {
startAnimation($("loginButton"), $("submit"));
var userName = $("userName").value;
var password = $("password").value;
if (userName.length > 0) {
var url = $("connectForm").getAttribute("action");
var parameters = ("userName=" + userName + "&password=" + password);
document.cookie = "";
triggerAjaxRequest(url, onLoginCallback, null, parameters,
{ "Content-type": "application/x-www-form-urlencoded",
"Content-length": parameters.length,
"Connection": "close" });
}
preventDefault(event);
}
function onLoginCallback(http) {
if (http.readyState == 4) {
if (isHttpStatus204(http.status))
window.location.href = ApplicationBaseURL + $("userName").value;
}
}
FastInit.addOnLoad(initLogin);