]> git.wh0rd.org Git - tt-rss.git/blob - include/login_form.php
Merge branch 'master' into jremote
[tt-rss.git] / include / login_form.php
1 <?php startup_gettext(); ?>
2 <html>
3 <head>
4         <title>Tiny Tiny RSS : Login</title>
5         <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
6         <link rel="stylesheet" type="text/css" href="css/tt-rss.css">
7         <link rel="shortcut icon" type="image/png" href="images/favicon.png">
8         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
9         <script type="text/javascript" src="lib/dojo/dojo.js"></script>
10         <script type="text/javascript" src="lib/dojo/tt-rss-layer.js"></script>
11         <script type="text/javascript" src="lib/prototype.js"></script>
12         <script type="text/javascript" src="js/functions.js"></script>
13         <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
14         <script type="text/javascript">
15                 require({cache:{}});
16                 Event.observe(window, 'load', function() {
17                         init();
18                 });
19         </script>
20         <style type="text/css">
21         body#ttrssLogin {
22                 padding : 2em;
23                 font-size : 14px;
24         }
25
26         fieldset {
27                 margin-left : auto;
28                 margin-right : auto;
29                 display : block;
30                 width : 400px;
31                 border-width : 0px;
32         }
33
34         input.input {
35                 font-family : sans-serif;
36                 font-size : medium;
37                 border-spacing : 2px;
38                 border : 1px solid #b5bcc7;
39                 padding : 2px;
40         }
41
42         label {
43                 width : 120px;
44                 margin-right : 20px;
45                 display : inline-block;
46                 text-align : right;
47                 color : gray;
48         }
49
50         div.header {
51                 border-width : 0px 0px 1px 0px;
52                 border-style : solid;
53                 border-color : #88b0f0;
54                 margin-bottom : 1em;
55                 padding-bottom : 5px;
56         }
57
58         div.footer {
59                 margin-top : 1em;
60                 padding-top : 5px;
61                 border-width : 1px 0px 0px 0px;
62                 border-style : solid;
63                 border-color : #88b0f0;
64                 text-align : center;
65                 color : gray;
66                 font-size : 12px;
67         }
68
69         a.forgotpass {
70                 text-align : right;
71                 font-size : 11px;
72                 display : inline-block;
73         }
74
75         a {
76                 color : #4684ff;
77         }
78
79         a:hover {
80                 color : black;
81         }
82
83         div.footer a {
84                 color : gray;
85         }
86
87         div.footer a:hover {
88                 color : #88b0f0;
89         }
90
91         div.row {
92                 padding : 0px 0px 5px 0px;
93         }
94
95         div.row-error {
96                 color : red;
97                 text-align : center;
98                 padding : 0px 0px 5px 0px;
99         }
100
101         </style>
102 </head>
103
104 <body id="ttrssLogin" class="claro">
105
106 <script type="text/javascript">
107 function init() {
108
109         require(['dojo/parser','dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
110         'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser){
111                 parser.parse();
112                 //show tooltip node only after this widget is instaniated.
113                 dojo.query('div[dojoType="dijit.Tooltip"]').style({
114                         display:''
115                 });
116                 fetchProfiles();
117                 dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true');
118                 document.forms.loginForm.login.focus();
119         });
120
121 }
122
123 function fetchProfiles() {
124         try {
125                 var query = "op=getProfiles&login=" + param_escape(document.forms["loginForm"].login.value);
126
127                 if (query) {
128                         new Ajax.Request("public.php",  {
129                                 parameters: query,
130                                 onComplete: function(transport) {
131                                         if (transport.responseText.match("select")) {
132                                                 $('profile_box').innerHTML = transport.responseText;
133                                                 dojo.parser.parse('profile_box');
134                                         }
135                         } });
136                 }
137
138         } catch (e) {
139                 exception_error("fetchProfiles", e);
140         }
141 }
142
143
144 function gotoRegForm() {
145         window.location.href = "register.php";
146         return false;
147 }
148
149 function bwLimitChange(elem) {
150         try {
151                 var limit_set = elem.checked;
152
153                 setCookie("ttrss_bwlimit", limit_set,
154                         <?php print SESSION_COOKIE_LIFETIME ?>);
155
156         } catch (e) {
157                 exception_error("bwLimitChange", e);
158         }
159 }
160 </script>
161
162 <?php $return = urlencode($_SERVER["REQUEST_URI"]) ?>
163
164 <form action="public.php?return=<?php echo $return ?>"
165         dojoType="dijit.form.Form" method="POST" id="loginForm" name="loginForm">
166
167 <input dojoType="dijit.form.TextBox" style="display : none" name="op" value="login">
168
169 <div class='header'>
170         <img src="images/logo_wide.png">
171 </div>
172
173 <div class='form'>
174
175         <fieldset>
176                 <?php if ($_SESSION["login_error_msg"]) { ?>
177                 <div class="row-error">
178                         <?php echo $_SESSION["login_error_msg"] ?>
179                 </div>
180                         <?php $_SESSION["login_error_msg"] = ""; ?>
181                 <?php } ?>
182                 <div class="row">
183                         <label><?php echo __("Login:") ?></label>
184                         <input name="login" class="input"
185                                 onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
186                                 style="width : 220px"
187                                 required="1"
188                                 value="<?php echo $_SESSION["fake_login"] ?>" />
189                 </div>
190
191
192                 <div class="row">
193                         <label><?php echo __("Password:") ?></label>
194                         <input type="password" name="password" required="1"
195                                         style="width : 220px" class="input"
196                                         value="<?php echo $_SESSION["fake_password"] ?>"/>
197                         <label></label>
198                 <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?>
199                         <a class='forgotpass' href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
200                 <?php } ?>
201                 </div>
202
203
204                 <div class="row">
205                         <label><?php echo __("Profile:") ?></label>
206
207                         <span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
208                                 style='width : 220px; margin : 0px'>
209                                 <option><?php echo __("Default profile") ?></option></select></span>
210
211                 </div>
212
213                 <div class="row">
214                         <label>&nbsp;</label>
215                         <input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit" type="checkbox"
216                                 onchange="bwLimitChange(this)">
217                         <label id="bw_limit_label" style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label>
218                 </div>
219
220                 <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
221 <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
222                 </div>
223
224                 <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
225
226                 <div class="row">
227                         <label>&nbsp;</label>
228                         <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
229                         <label style='display : inline' for="remember_me"><?php echo __("Remember me") ?></label>
230                 </div>
231
232                 <?php } ?>
233
234                 <div class="row" style='text-align : right'>
235                         <button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button>
236                         <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
237                                 <button onclick="return gotoRegForm()" dojoType="dijit.form.Button">
238                                         <?php echo __("Create new account") ?></button>
239                         <?php } ?>
240                 </div>
241
242         </fieldset>
243
244
245 </div>
246
247 <div class='footer'>
248         <a href="http://tt-rss.org/">Tiny Tiny RSS</a>
249         <?php if (!defined('HIDE_VERSION')) { ?>
250                  v<?php echo VERSION ?>
251         <?php } ?>
252         &copy; 2005&ndash;<?php echo date('Y') ?> <a href="http://fakecake.org/">Andrew Dolgov</a>
253 </div>
254
255 </form>
256
257 </body></html>