login_form.php 6.0 KB

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