login_form.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 : #0088cc;
  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 : #0088cc;
  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 : #0088cc;
  74. }
  75. a {
  76. color: #0088cc;
  77. text-decoration: none;
  78. }
  79. a:hover,
  80. a:focus {
  81. color: #005580;
  82. text-decoration: underline;
  83. }
  84. div.footer a {
  85. color : gray;
  86. }
  87. div.footer a:hover {
  88. color : #0088cc;
  89. }
  90. div.row {
  91. padding : 0px 0px 5px 0px;
  92. }
  93. div.row-error {
  94. color : red;
  95. text-align : center;
  96. padding : 0px 0px 5px 0px;
  97. }
  98. </style>
  99. </head>
  100. <body id="ttrssLogin" class="claro">
  101. <script type="text/javascript">
  102. function init() {
  103. require(['dojo/parser','dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
  104. 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser){
  105. parser.parse();
  106. //show tooltip node only after this widget is instaniated.
  107. dojo.query('div[dojoType="dijit.Tooltip"]').style({
  108. display:''
  109. });
  110. fetchProfiles();
  111. dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true');
  112. document.forms.loginForm.login.focus();
  113. });
  114. }
  115. function fetchProfiles() {
  116. try {
  117. var query = "op=getProfiles&login=" + param_escape(document.forms["loginForm"].login.value);
  118. if (query) {
  119. new Ajax.Request("public.php", {
  120. parameters: query,
  121. onComplete: function(transport) {
  122. if (transport.responseText.match("select")) {
  123. $('profile_box').innerHTML = transport.responseText;
  124. dojo.parser.parse('profile_box');
  125. }
  126. } });
  127. }
  128. } catch (e) {
  129. exception_error("fetchProfiles", e);
  130. }
  131. }
  132. function gotoRegForm() {
  133. window.location.href = "register.php";
  134. return false;
  135. }
  136. function bwLimitChange(elem) {
  137. try {
  138. var limit_set = elem.checked;
  139. setCookie("ttrss_bwlimit", limit_set,
  140. <?php print SESSION_COOKIE_LIFETIME ?>);
  141. } catch (e) {
  142. exception_error("bwLimitChange", e);
  143. }
  144. }
  145. </script>
  146. <?php $return = urlencode($_SERVER["REQUEST_URI"]) ?>
  147. <form action="public.php?return=<?php echo $return ?>"
  148. dojoType="dijit.form.Form" method="POST" id="loginForm" name="loginForm">
  149. <input dojoType="dijit.form.TextBox" style="display : none" name="op" value="login">
  150. <div class='header'>
  151. <img src="images/logo_wide.png">
  152. </div>
  153. <div class='form'>
  154. <fieldset>
  155. <?php if ($_SESSION["login_error_msg"]) { ?>
  156. <div class="row-error">
  157. <?php echo $_SESSION["login_error_msg"] ?>
  158. </div>
  159. <?php $_SESSION["login_error_msg"] = ""; ?>
  160. <?php } ?>
  161. <div class="row">
  162. <label><?php echo __("Login:") ?></label>
  163. <input name="login" class="input input-text" type="text"
  164. onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
  165. style="width : 220px"
  166. required="1"
  167. value="<?php echo $_SESSION["fake_login"] ?>" />
  168. </div>
  169. <div class="row">
  170. <label><?php echo __("Password:") ?></label>
  171. <input type="password" name="password" required="1"
  172. style="width : 220px" class="input input-text"
  173. value="<?php echo $_SESSION["fake_password"] ?>"/>
  174. <label></label>
  175. <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?>
  176. <a class='forgotpass' href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
  177. <?php } ?>
  178. </div>
  179. <div class="row">
  180. <label><?php echo __("Profile:") ?></label>
  181. <span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
  182. style='width : 220px; margin : 0px'>
  183. <option><?php echo __("Default profile") ?></option></select></span>
  184. </div>
  185. <div class="row">
  186. <label>&nbsp;</label>
  187. <input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit" type="checkbox"
  188. onchange="bwLimitChange(this)">
  189. <label id="bw_limit_label" style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label>
  190. </div>
  191. <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
  192. <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
  193. </div>
  194. <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
  195. <div class="row">
  196. <label>&nbsp;</label>
  197. <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
  198. <label style='display : inline' for="remember_me"><?php echo __("Remember me") ?></label>
  199. </div>
  200. <?php } ?>
  201. <div class="row" style='text-align : right'>
  202. <button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button>
  203. <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
  204. <button onclick="return gotoRegForm()" dojoType="dijit.form.Button">
  205. <?php echo __("Create new account") ?></button>
  206. <?php } ?>
  207. </div>
  208. </fieldset>
  209. </div>
  210. <div class='footer'>
  211. <a href="http://tt-rss.org/">Tiny Tiny RSS</a>
  212. &copy; 2005&ndash;<?php echo date('Y') ?> <a href="http://fakecake.org/">Andrew Dolgov</a>
  213. </div>
  214. </form>
  215. </body></html>