sysauth.ut 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {#
  2. Copyright 2008 Steven Barth <steven@midlink.org>
  3. Copyright 2008-2012 Jo-Philipp Wich <jow@openwrt.org>
  4. Licensed to the public under the Apache License 2.0.
  5. -#}
  6. {% include('header') %}
  7. <form method="post">
  8. {% if (fuser): %}
  9. <div class="alert-message warning">
  10. <p>{{ _('Invalid username and/or password! Please try again.') }}</p>
  11. </div>
  12. {% endif %}
  13. <div class="cbi-map">
  14. <h2 name="content">{{ _('Authorization Required') }}</h2>
  15. <div class="cbi-map-descr">
  16. {{ _('Please enter your username and password.') }}
  17. </div>
  18. <div class="cbi-section"><div class="cbi-section-node">
  19. <div class="cbi-value">
  20. <label class="cbi-value-title">{{ _('Username') }}</label>
  21. <div class="cbi-value-field">
  22. <input class="cbi-input-text" type="text" name="luci_username" value="{{ entityencode(duser, true) }}" />
  23. </div>
  24. </div>
  25. <div class="cbi-value cbi-value-last">
  26. <label class="cbi-value-title">{{ _('Password') }}</label>
  27. <div class="cbi-value-field">
  28. <input class="cbi-input-text" type="password" name="luci_password" />
  29. </div>
  30. </div>
  31. </div></div>
  32. </div>
  33. <div class="cbi-page-actions">
  34. <input type="submit" value="{{ _('Log in') }}" class="btn cbi-button cbi-button-apply" />
  35. <input type="reset" value="{{ _('Reset') }}" class="btn cbi-button cbi-button-reset" />
  36. </div>
  37. </form>
  38. {%
  39. let https_ports = uci.get('uhttpd', 'main', 'listen_https') ?? [];
  40. https_ports = uniq(filter(
  41. map(
  42. (type(https_ports) == 'string') ? split(https_port, /\s+/) : https_ports,
  43. e => +match(e, /\d+$/)?.[0]
  44. ),
  45. p => (p >= 0 && p <= 65535)
  46. ));
  47. %}
  48. <script>
  49. var input = document.getElementsByName('luci_password')[0];
  50. if (input)
  51. input.focus();
  52. if (document.location.protocol != 'https:') {
  53. {{ https_ports }}.forEach(function(port) {
  54. var url = 'https://' + window.location.hostname + ':' + port + window.location.pathname;
  55. var img = new Image();
  56. img.onload = function() { window.location = url };
  57. img.src = 'https://' + window.location.hostname + ':' + port + '{{ resource }}/icons/loading.gif?' + Math.random();
  58. setTimeout(function() { img.src = '' }, 5000);
  59. });
  60. }
  61. </script>
  62. {% include('footer') %}