2007-09-04 17:00:44 +02:00
|
|
|
function initLogin() {
|
2007-09-07 00:18:08 +02:00
|
|
|
var date = new Date();
|
|
|
|
date.setTime(date.getTime() - 86400000);
|
|
|
|
document.cookie = ("0xHIGHFLYxSOGo-0.9=discard; path=/"
|
|
|
|
+ "; expires=" + date.toGMTString());
|
2007-09-04 17:00:44 +02:00
|
|
|
var submit = $("submit");
|
2007-09-07 00:18:08 +02:00
|
|
|
Event.observe(submit, "click", onLoginClick);
|
|
|
|
|
2007-09-04 17:00:44 +02:00
|
|
|
var userName = $("userName");
|
|
|
|
userName.focus();
|
2007-09-05 19:56:00 +02:00
|
|
|
|
|
|
|
var image = $("preparedAnimation");
|
|
|
|
image.parentNode.removeChild(image);
|
2007-09-04 17:00:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onLoginClick(event) {
|
|
|
|
startAnimation($("loginButton"), $("submit"));
|
|
|
|
|
2007-09-07 00:18:08 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2007-09-10 20:42:13 +02:00
|
|
|
preventDefault(event);
|
2007-09-07 00:18:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onLoginCallback(http) {
|
|
|
|
if (http.readyState == 4) {
|
2007-09-10 20:42:13 +02:00
|
|
|
if (isHttpStatus204(http.status)) {
|
2007-09-07 00:18:08 +02:00
|
|
|
window.location.href = ApplicationBaseURL + $("userName").value;
|
|
|
|
}
|
|
|
|
}
|
2007-09-04 17:00:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
addEvent(window, 'load', initLogin);
|