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