]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/reporter/templates/login.ttk
updated to work with new login params. removed Cookie.js requirement in favor of...
[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                         function initPage() {
10                         document.getElementById("reports_login_username").focus();
11                         document.getElementById("reports_login_username").onkeypress = checkInputClicks;
12                         document.getElementById("reports_login_password").onkeypress = checkInputClicks;
13                         }
14
15                         function checkInputClicks(evt) {
16                                 if(userPressedEnter(evt)) doLogin();
17                         }
18
19
20                         function doLogin() {
21
22                         var uname = document.getElementById("reports_login_username").value;
23                         var passwd = document.getElementById("reports_login_password").value;
24                         
25                         var init_request = new RemoteRequest( 
26                                         "open-ils.auth", 
27                                         "open-ils.auth.authenticate.init", uname );
28         
29                         init_request.send(true);
30                         var seed = init_request.getResultObject();
31                         
32                         if( ! seed || seed == '0') {
33                                 alert( "Error Communicating with Authentication Server" );
34                                 return null;
35                         }
36                         
37                         var auth_request = new RemoteRequest( 
38                                         "open-ils.auth", "open-ils.auth.authenticate.complete",
39                                         {       
40                                                 username : uname,
41                                                 password : hex_md5(seed + hex_md5(passwd)),
42                                                 type : "staff" 
43                                         });
44                         
45                         auth_request.send(true);
46                         var auth_result = auth_request.getResultObject().payload.authtoken;
47                         
48                         if(auth_result == '0' || auth_result == null || auth_result.length == 0) { 
49                                         alert("Login failed");
50                                         return false; 
51                                 }
52         
53                                 cookieManager.write(COOKIE_SES, auth_result, '+1d');
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