login_form.php 6.1 KB

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