login_form.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. </head>
  24. <body class="claro ttrss_main ttrss_login">
  25. <script type="text/javascript">
  26. function init() {
  27. require(['dojo/parser','dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
  28. 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser){
  29. parser.parse();
  30. //show tooltip node only after this widget is instaniated.
  31. dojo.query('div[dojoType="dijit.Tooltip"]').style({
  32. display:''
  33. });
  34. fetchProfiles();
  35. dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true');
  36. document.forms.loginForm.login.focus();
  37. });
  38. }
  39. function fetchProfiles() {
  40. try {
  41. var query = "op=getProfiles&login=" + param_escape(document.forms["loginForm"].login.value);
  42. if (query) {
  43. new Ajax.Request("public.php", {
  44. parameters: query,
  45. onComplete: function(transport) {
  46. if (transport.responseText.match("select")) {
  47. $('profile_box').innerHTML = transport.responseText;
  48. //dojo.parser.parse('profile_box');
  49. }
  50. } });
  51. }
  52. } catch (e) {
  53. exception_error("fetchProfiles", e);
  54. }
  55. }
  56. function gotoRegForm() {
  57. window.location.href = "register.php";
  58. return false;
  59. }
  60. function bwLimitChange(elem) {
  61. try {
  62. var limit_set = elem.checked;
  63. setCookie("ttrss_bwlimit", limit_set,
  64. <?php print SESSION_COOKIE_LIFETIME ?>);
  65. } catch (e) {
  66. exception_error("bwLimitChange", e);
  67. }
  68. }
  69. </script>
  70. <?php $return = urlencode($_SERVER["REQUEST_URI"]) ?>
  71. <form action="public.php?return=<?php echo $return ?>"
  72. dojoType="dijit.form.Form" method="POST" id="loginForm" name="loginForm">
  73. <input dojoType="dijit.form.TextBox" style="display : none" name="op" value="login">
  74. <div class='header'>
  75. <img src="images/logo_wide.png">
  76. </div>
  77. <div class='form'>
  78. <fieldset>
  79. <?php if ($_SESSION["login_error_msg"]) { ?>
  80. <div class="row-error">
  81. <?php echo $_SESSION["login_error_msg"] ?>
  82. </div>
  83. <?php $_SESSION["login_error_msg"] = ""; ?>
  84. <?php } ?>
  85. <div class="row">
  86. <label><?php echo __("Login:") ?></label>
  87. <input name="login" class="input input-text" type="text"
  88. onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
  89. style="width : 220px"
  90. required="1"
  91. value="<?php echo $_SESSION["fake_login"] ?>" />
  92. </div>
  93. <div class="row">
  94. <label><?php echo __("Password:") ?></label>
  95. <input type="password" name="password" required="1"
  96. style="width : 220px" class="input input-text"
  97. value="<?php echo $_SESSION["fake_password"] ?>"/>
  98. <label></label>
  99. <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?>
  100. <a class='forgotpass' href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
  101. <?php } ?>
  102. </div>
  103. <div class="row">
  104. <label><?php echo __("Profile:") ?></label>
  105. <span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
  106. style='width : 220px; margin : 0px'>
  107. <option><?php echo __("Default profile") ?></option></select></span>
  108. </div>
  109. <div class="row">
  110. <label>&nbsp;</label>
  111. <input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit" type="checkbox"
  112. onchange="bwLimitChange(this)">
  113. <label id="bw_limit_label" style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label>
  114. </div>
  115. <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
  116. <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
  117. </div>
  118. <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
  119. <div class="row">
  120. <label>&nbsp;</label>
  121. <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
  122. <label style='display : inline' for="remember_me"><?php echo __("Remember me") ?></label>
  123. </div>
  124. <?php } ?>
  125. <div class="row" style='text-align : right'>
  126. <button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button>
  127. <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
  128. <button onclick="return gotoRegForm()" dojoType="dijit.form.Button">
  129. <?php echo __("Create new account") ?></button>
  130. <?php } ?>
  131. </div>
  132. </fieldset>
  133. </div>
  134. <div class='footer'>
  135. <a href="http://tt-rss.org/">Tiny Tiny RSS</a>
  136. &copy; 2005&ndash;<?php echo date('Y') ?> <a href="http://fakecake.org/">Andrew Dolgov</a>
  137. </div>
  138. </form>
  139. </body></html>