login_form.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php startup_gettext(); ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>Tiny Tiny RSS : Login</title>
  6. <link rel="shortcut icon" type="image/png" href="images/favicon.png">
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. <?php
  9. foreach (array("lib/prototype.js",
  10. "lib/dojo/dojo.js",
  11. "lib/dojo/tt-rss-layer.js",
  12. "lib/prototype.js",
  13. "js/common.js",
  14. "js/utility.js",
  15. "errors.php?mode=js") as $jsfile) {
  16. echo javascript_tag($jsfile);
  17. } ?>
  18. <style type="text/css">
  19. @media (prefers-color-scheme: dark) {
  20. body {
  21. background : #303030;
  22. }
  23. }
  24. body.css_loading * {
  25. display : none;
  26. }
  27. </style>
  28. <script type="text/javascript">
  29. require({cache:{}});
  30. </script>
  31. </head>
  32. <body class="flat ttrss_utility ttrss_login css_loading">
  33. <script type="text/javascript">
  34. const UtilityApp = {
  35. previousLogin: "",
  36. init: function() { /* invoked by UtilityJS */
  37. require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox', 'dijit/form/Form',
  38. 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
  39. ready(function() {
  40. parser.parse();
  41. dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true');
  42. dijit.byId("login").focus();
  43. });
  44. });
  45. },
  46. fetchProfiles: function() {
  47. const login = dijit.byId("login").attr('value');
  48. if (login && login != this.previousLogin) {
  49. this.previousLogin = login;
  50. xhrJson("public.php", {op: "getprofiles", login: login},
  51. (reply) => {
  52. const profile = dijit.byId('profile');
  53. profile.removeOption(profile.getOptions());
  54. reply.each((p) => {
  55. profile
  56. .attr("disabled", false)
  57. .addOption(p);
  58. });
  59. });
  60. }
  61. },
  62. gotoRegForm: function() {
  63. window.location.href = "register.php";
  64. return false;
  65. },
  66. bwLimitChange: function(elem) {
  67. Cookie.set("ttrss_bwlimit", elem.checked,
  68. <?php print SESSION_COOKIE_LIFETIME ?>);
  69. }
  70. };
  71. </script>
  72. <?php $return = urlencode(make_self_url()) ?>
  73. <div class="container">
  74. <h1><?php echo "Authentication" ?></h1>
  75. <div class="content">
  76. <form action="public.php?return=<?php echo $return ?>"
  77. dojoType="dijit.form.Form" method="POST">
  78. <?php print_hidden("op", "login"); ?>
  79. <?php if ($_SESSION["login_error_msg"]) { ?>
  80. <?php echo format_error($_SESSION["login_error_msg"]) ?>
  81. <?php $_SESSION["login_error_msg"] = ""; ?>
  82. <?php } ?>
  83. <fieldset>
  84. <label><?php echo __("Login:") ?></label>
  85. <input name="login" id="login" dojoType="dijit.form.TextBox" type="text"
  86. onchange="UtilityApp.fetchProfiles()"
  87. onfocus="UtilityApp.fetchProfiles()"
  88. onblur="UtilityApp.fetchProfiles()"
  89. required="1" value="<?php echo $_SESSION["fake_login"] ?>" />
  90. </fieldset>
  91. <fieldset>
  92. <label><?php echo __("Password:") ?></label>
  93. <input type="password" name="password" required="1"
  94. dojoType="dijit.form.TextBox"
  95. class="input input-text"
  96. onchange="UtilityApp.fetchProfiles()"
  97. onfocus="UtilityApp.fetchProfiles()"
  98. onblur="UtilityApp.fetchProfiles()"
  99. value="<?php echo $_SESSION["fake_password"] ?>"/>
  100. </fieldset>
  101. <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?>
  102. <fieldset class="align-right">
  103. <a href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
  104. </fieldset>
  105. <?php } ?>
  106. <fieldset>
  107. <label><?php echo __("Profile:") ?></label>
  108. <select disabled='disabled' name="profile" id="profile" dojoType='dijit.form.Select'>
  109. <option><?php echo __("Default profile") ?></option>
  110. </select>
  111. </fieldset>
  112. <fieldset class="narrow">
  113. <label> </label>
  114. <label id="bw_limit_label"><input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit"
  115. type="checkbox" onchange="UtilityApp.bwLimitChange(this)">
  116. <?php echo __("Use less traffic") ?></label>
  117. </fieldset>
  118. <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
  119. <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
  120. </div>
  121. <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
  122. <fieldset class="narrow">
  123. <label> </label>
  124. <label>
  125. <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
  126. <?php echo __("Remember me") ?>
  127. </label>
  128. </fieldset>
  129. <?php } ?>
  130. <hr/>
  131. <fieldset class="align-right">
  132. <label> </label>
  133. <button dojoType="dijit.form.Button" type="submit" class="alt-primary"><?php echo __('Log in') ?></button>
  134. <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
  135. <button onclick="return UtilityApp.gotoRegForm()" dojoType="dijit.form.Button">
  136. <?php echo __("Create new account") ?></button>
  137. <?php } ?>
  138. </fieldset>
  139. </form>
  140. </div>
  141. <div class="footer">
  142. <a href="https://tt-rss.org/">Tiny Tiny RSS</a>
  143. &copy; 2005&ndash;<?php echo date('Y') ?> <a href="https://fakecake.org/">Andrew Dolgov</a>
  144. </div>
  145. </div>
  146. </body>
  147. </html>