]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/reporter/templates/login.ttk
bd6049428ca66fd1cf2ab01e4f43adf536f6af40
[Evergreen.git] / Open-ILS / src / reporter / templates / login.ttk
1 <html>
2
3         [% INCLUDE header.ttk title="Login" %]
4
5         <body onload='initPage();'>
6
7                 <script language='javascript'>
8
9                         var COOKIE_SES = "ses";
10                         var cookie = new cookieObject("ses", 1, "/", COOKIE_SES);
11
12                         function initPage() {
13                         document.getElementById("reports_login_username").focus();
14                         document.getElementById("reports_login_username").onkeypress = checkInputClicks;
15                         document.getElementById("reports_login_password").onkeypress = checkInputClicks;
16                         }
17
18                         function checkInputClicks(evt) {
19                                 if(userPressedEnter(evt)) doLogin();
20                         }
21
22
23                         function doLogin() {
24
25                         var uname = document.getElementById("reports_login_username").value;
26                         var passwd = document.getElementById("reports_login_password").value;
27                         
28                         var init_request = new RemoteRequest( 
29                                         "open-ils.auth", 
30                                         "open-ils.auth.authenticate.init", uname );
31         
32                         init_request.send(true);
33                         var seed = init_request.getResultObject();
34                         
35                         if( ! seed || seed == '0') {
36                                 alert( "Error Communicating with Authentication Server" );
37                                 return null;
38                         }
39                         
40                         var auth_request = new RemoteRequest( 
41                                         "open-ils.auth", "open-ils.auth.authenticate.complete",
42                                         uname, hex_md5(seed + hex_md5(passwd)), "staff");
43                         
44                         auth_request.send(true);
45                         var auth_result = auth_request.getResultObject().payload.authtoken;
46                         
47                         if(auth_result == '0' || auth_result == null || auth_result.length == 0) { 
48                                         alert("Login failed");
49                                         return false; 
50                                 }
51         
52                                 cookie.put(COOKIE_SES, auth_result);
53                                 cookie.write();
54                                 location.href = location.href;
55                 
56                         }
57
58                 </script>
59
60                 <br/>
61                 <center>
62                 <h3> Reports Login </h3>
63                 <table style='padding: 4px; border: 2px solid #E0E0E0;'>
64                         <tr>
65                                 <td >Username: </td>
66                                 <td ><input type='text' id='reports_login_username'/></td>
67                         </tr>
68                         <tr>
69                                 <td >Password: </td>
70                                 <td ><input type='password' id='reports_login_password'/></td>
71                         <tr>
72                         </tr>
73                                 <td><input type='submit' value='Login' onclick='doLogin();'/></td>
74                         </tr>
75                 </table>
76                 </center>
77
78         </body>
79
80         [% INCLUDE footer.ttk %]
81
82 </html>
83
84
85
86