]> err.no Git - scalable-opengroupware.org/blob - UI/WebServerResources/SOGoRootPage.js
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1209 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / WebServerResources / SOGoRootPage.js
1 function initLogin() {
2   var date = new Date();
3   date.setTime(date.getTime() - 86400000);
4   document.cookie = ("0xHIGHFLYxSOGo-0.9=discard; path=/"
5                      + "; expires=" + date.toGMTString());
6   var submit = $("submit");
7   Event.observe(submit, "click", onLoginClick);
8
9   var userName = $("userName");
10   userName.focus();
11
12   var image = $("preparedAnimation");
13   image.parentNode.removeChild(image);
14 }
15
16 function onLoginClick(event) {
17   startAnimation($("loginButton"), $("submit"));
18
19   var userName = $("userName").value;
20   var password = $("password").value;
21
22   if (userName.length > 0) {
23     var url = ($("connectForm").getAttribute("action")
24                + "?userName=" + userName
25                + "&password=" + password);
26     document.cookie = "";
27     triggerAjaxRequest(url, onLoginCallback);
28   }
29
30   preventDefault(event);
31 }
32
33 function onLoginCallback(http) {
34   if (http.readyState == 4) {
35     if (isHttpStatus204(http.status)) {
36       window.location.href = ApplicationBaseURL + $("userName").value;
37     }
38   }
39 }
40
41 addEvent(window, 'load', initLogin);