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