login_form.php 6.1 KB

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