login_form.php 4.3 KB

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