]> git.wh0rd.org Git - tt-rss.git/blob - login_form.php
release 1.5.3
[tt-rss.git] / login_form.php
1 <html>
2 <head>
3         <title>Tiny Tiny RSS : Login</title>
4         <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
5         <link rel="stylesheet" type="text/css" href="tt-rss.css">
6         <link rel="shortcut icon" type="image/png" href="images/favicon.png">
7         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8         <script type="text/javascript" src="lib/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
9         <script type="text/javascript" src="lib/prototype.js"></script>
10         <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
11         <script type="text/javascript" src="functions.js"></script>
12         <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
13 </head>
14
15 <body id="ttrssLogin" class="claro">
16
17 <script type="text/javascript">
18 function init() {
19
20         dojo.require("dijit.Dialog");
21
22         var test = setCookie("ttrss_test", "TEST");
23
24         if (getCookie("ttrss_test") != "TEST") {
25                 return fatalError(2);
26         }
27
28         var limit_set = getCookie("ttrss_bwlimit");
29
30         if (limit_set == "true") {
31                 document.forms["loginForm"].bw_limit.checked = true;
32         }
33
34         document.forms["loginForm"].login.focus();
35 }
36
37 function fetchProfiles() {
38         try {
39                 var params = Form.serialize('loginForm');
40                 var query = "?op=getProfiles&" + params;
41
42                 if (query) {
43                         new Ajax.Request("backend.php", {
44                                 parameters: query,
45                                         onComplete: function(transport) {
46                                                 if (transport.responseText.match("select")) {
47                                                         $('profile_box').innerHTML = transport.responseText;
48                                                 }
49                                 } });
50                 }
51
52         } catch (e) {
53                 exception_error("fetchProfiles", e);
54         }
55 }
56
57
58 function languageChange(elem) {
59         try {
60                 document.forms['loginForm']['click'].disabled = true;
61
62                 var lang = elem[elem.selectedIndex].value;
63                 setCookie("ttrss_lang", lang, <?php print SESSION_COOKIE_LIFETIME ?>);
64                 window.location.reload();
65         } catch (e) {
66                 exception_error("languageChange", e);
67         }
68 }
69
70 function gotoRegForm() {
71         window.location.href = "register.php";
72         return false;
73 }
74
75 function bwLimitChange(elem) {
76         try {
77                 var limit_set = elem.checked;
78
79                 setCookie("ttrss_bwlimit", limit_set,
80                         <?php print SESSION_COOKIE_LIFETIME ?>);
81
82         } catch (e) {
83                 exception_error("bwLimitChange", e);
84         }
85 }
86
87 function validateLoginForm(f) {
88         try {
89
90                 if (f.login.value.length == 0) {
91                         new Effect.Highlight(f.login);
92                         return false;
93                 }
94
95                 if (f.password.value.length == 0) {
96                         new Effect.Highlight(f.password);
97                         return false;
98                 }
99
100                 document.forms['loginForm']['click'].disabled = true;
101
102                 return true;
103         } catch (e) {
104                 exception_error("validateLoginForm", e);
105                 return true;
106         }
107 }
108 </script>
109
110 <script type="text/javascript">
111         Event.observe(window, 'load', function() {
112                 init();
113         });
114 </script>
115
116 <form action="" method="POST" id="loginForm" name="loginForm" onsubmit="return validateLoginForm(this)">
117 <input type="hidden" name="login_action" value="do_login">
118
119 <table width="100%" class="loginForm2">
120 <tr>
121         <td class="loginTop" valign="bottom" align="left">
122                 <img src="images/logo_wide.png">
123         </td>
124 </tr><tr>
125         <td align="center" valign="middle" class="loginMiddle" height="100%">
126                 <?php if ($_SESSION['login_error_msg']) { ?>
127                         <div class="loginError"><?php echo $_SESSION['login_error_msg'] ?></div>
128                         <?php $_SESSION['login_error_msg'] = ""; ?>
129                 <?php } ?>
130                 <table>
131                         <tr><td align="right"><?php echo __("Login:") ?></td>
132                         <td align="right"><input name="login"
133                                 onchange="fetchProfiles()" onfocus="fetchProfiles()"
134                                 value="<?php echo get_remote_user($link) ?>"></td></tr>
135                         <tr><td align="right"><?php echo __("Password:") ?></td>
136                         <td align="right"><input type="password" name="password"
137                                 onchange="fetchProfiles()" onfocus="fetchProfiles()"
138                                 value="<?php echo get_remote_fakepass($link) ?>"></td></tr>
139                         <tr><td align="right"><?php echo __("Language:") ?></td>
140                         <td align="right">
141                         <?php
142                                 print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(),
143                                         "style='width : 100%' onchange='languageChange(this)'");
144
145                         ?>
146                         </td></tr>
147
148                         <tr><td align="right"><?php echo __("Profile:") ?></td>
149                         <td align="right" id="profile_box">
150                         <select style='width : 100%' disabled='1'>
151                                 <option><?php echo __("Default profile") ?></option></select>
152                         </td></tr>
153
154                         <!-- <tr><td colspan="2">
155                                 <input type="checkbox" name="remember_me" id="remember_me">
156                                 <label for="remember_me">Remember me on this computer</label>
157                         </td></tr> -->
158
159                         <tr><td colspan="2" align="right" class="innerLoginCell">
160
161                         <button type="submit" name='click'><?php echo __('Log in') ?></button>
162                         <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
163                                 <button onclick="return gotoRegForm()">
164                                         <?php echo __("Create new account") ?></button>
165                         <?php } ?>
166
167                                 <input type="hidden" name="action" value="login">
168                                 <input type="hidden" name="rt"
169                                         value="<?php if ($return_to != 'none') { echo $return_to; } ?>">
170                         </td></tr>
171
172                         <tr><td colspan="2" align="right" class="innerLoginCell">
173
174                         <div class="small">
175                         <input name="bw_limit" id="bw_limit" type="checkbox"
176                                 onchange="bwLimitChange(this)">
177                         <label for="bw_limit">
178                         <?php echo __("Use less traffic") ?></label></div>
179
180                         </td></tr>
181
182
183                 </table>
184         </td>
185 </tr><tr>
186         <td align="center" class="loginBottom">
187         <a href="http://tt-rss.org/">Tiny Tiny RSS</a>
188         <?php if (!defined('HIDE_VERSION')) { ?>
189                  v<?php echo VERSION ?>
190         <?php } ?>
191         &copy; 2005&ndash;<?php echo date('Y') ?> <a href="http://fakecake.org/">Andrew Dolgov</a>
192         </td>
193 </tr>
194
195 </table>
196
197 </form>
198
199 </body></html>