login_form.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php startup_gettext(); ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>Tiny Tiny RSS : Login</title>
  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/common.js",
  14. "errors.php?mode=js") as $jsfile) {
  15. echo javascript_tag($jsfile);
  16. } ?>
  17. <script type="text/javascript">
  18. require({cache:{}});
  19. </script>
  20. </head>
  21. <body class="flat ttrss_utility ttrss_login">
  22. <script type="text/javascript">
  23. require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox', 'dijit/form/Form',
  24. 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
  25. ready(function() {
  26. parser.parse();
  27. dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true');
  28. dijit.byId("login").focus();
  29. });
  30. });
  31. function fetchProfiles() {
  32. xhrJson("public.php", { op: "getprofiles", login: dijit.byId("login").attr('value') },
  33. (reply) => {
  34. const profile = dijit.byId('profile');
  35. profile.removeOption(profile.getOptions());
  36. reply.each((p) => {
  37. profile
  38. .attr("disabled", false)
  39. .addOption(p);
  40. });
  41. });
  42. }
  43. function gotoRegForm() {
  44. window.location.href = "register.php";
  45. return false;
  46. }
  47. function bwLimitChange(elem) {
  48. Cookie.set("ttrss_bwlimit", elem.checked,
  49. <?php print SESSION_COOKIE_LIFETIME ?>);
  50. }
  51. </script>
  52. <?php $return = urlencode($_SERVER["REQUEST_URI"]) ?>
  53. <div class="container">
  54. <h1><?php echo "Authentication" ?></h1>
  55. <div class="content">
  56. <form action="public.php?return=<?php echo $return ?>"
  57. dojoType="dijit.form.Form" method="POST">
  58. <?php print_hidden("op", "login"); ?>
  59. <?php if ($_SESSION["login_error_msg"]) { ?>
  60. <?php echo format_error($_SESSION["login_error_msg"]) ?>
  61. <?php $_SESSION["login_error_msg"] = ""; ?>
  62. <?php } ?>
  63. <fieldset>
  64. <label><?php echo __("Login:") ?></label>
  65. <input name="login" id="login" dojoType="dijit.form.TextBox" type="text"
  66. onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
  67. required="1" value="<?php echo $_SESSION["fake_login"] ?>" />
  68. </fieldset>
  69. <fieldset>
  70. <label><?php echo __("Password:") ?></label>
  71. <input type="password" name="password" required="1"
  72. dojoType="dijit.form.TextBox"
  73. class="input input-text"
  74. value="<?php echo $_SESSION["fake_password"] ?>"/>
  75. <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?>
  76. <a href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
  77. <?php } ?>
  78. </fieldset>
  79. <fieldset>
  80. <label><?php echo __("Profile:") ?></label>
  81. <select disabled='disabled' name="profile" id="profile" dojoType='dijit.form.Select'>
  82. <option><?php echo __("Default profile") ?></option>
  83. </select>
  84. </fieldset>
  85. <fieldset class="narrow">
  86. <label> </label>
  87. <label id="bw_limit_label"><input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit"
  88. type="checkbox" onchange="bwLimitChange(this)">
  89. <?php echo __("Use less traffic") ?></label>
  90. </fieldset>
  91. <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
  92. <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
  93. </div>
  94. <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
  95. <fieldset class="narrow">
  96. <label> </label>
  97. <label>
  98. <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
  99. <?php echo __("Remember me") ?>
  100. </label>
  101. </fieldset>
  102. <?php } ?>
  103. <hr/>
  104. <fieldset class="align-right">
  105. <label> </label>
  106. <button dojoType="dijit.form.Button" type="submit" class="alt-primary"><?php echo __('Log in') ?></button>
  107. <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
  108. <button onclick="return gotoRegForm()" dojoType="dijit.form.Button">
  109. <?php echo __("Create new account") ?></button>
  110. <?php } ?>
  111. </fieldset>
  112. </form>
  113. </div>
  114. <div class="footer">
  115. <a href="https://tt-rss.org/">Tiny Tiny RSS</a>
  116. &copy; 2005&ndash;<?php echo date('Y') ?> <a href="https://fakecake.org/">Andrew Dolgov</a>
  117. </div>
  118. </div>
  119. </body>
  120. </html>