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