sogo/UI/WebServerResources/SOGoRootPage.js
Francis Lachapelle a2d7ad9ad3 Monotone-Parent: f95c202e8a677fb1f00e60e9dde0d8bb8e420572
Monotone-Revision: 006f9f5fa97b150e56360e2767123d6b1e77e8cc

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-11-15T19:02:23
Monotone-Branch: ca.inverse.sogo
2007-11-15 19:02:23 +00:00

42 lines
1 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")
+ "?userName=" + userName
+ "&password=" + password);
document.cookie = "";
triggerAjaxRequest(url, onLoginCallback);
}
preventDefault(event);
}
function onLoginCallback(http) {
if (http.readyState == 4) {
if (isHttpStatus204(http.status)) {
window.location.href = ApplicationBaseURL + $("userName").value;
}
}
}
FastInit.addOnLoad(initLogin);