You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.0 KiB

  1. <?php $this->layout('layout', ['title' => $title]); ?>
  2. <style type="text/css">
  3. body {
  4. background-color: #DADADA;
  5. }
  6. body > .grid {
  7. height: 100%;
  8. }
  9. .image {
  10. margin-top: -100px;
  11. }
  12. .column {
  13. max-width: 450px;
  14. }
  15. </style>
  16. <div class="ui middle aligned center aligned grid">
  17. <div class="column">
  18. <h2 class="ui teal image header">
  19. <img src="/assets/telegraph-logo-256.png" class="image">
  20. <div class="content">
  21. Sign in to Telegraph
  22. </div>
  23. </h2>
  24. <?php if(isset($error)): ?>
  25. <div class="ui warning message" style="word-wrap: break-word;">
  26. <div class="header"><?= $error ?></div>
  27. <?= $error_description ?>
  28. </div>
  29. <?php endif; ?>
  30. <form class="ui large form" action="/login/start" method="POST" >
  31. <div class="ui stacked segment">
  32. <div class="field">
  33. <div class="ui left icon input">
  34. <i class="globe icon"></i>
  35. <input type="url" name="url" placeholder="Your Web Address">
  36. </div>
  37. </div>
  38. <input type="hidden" name="return_to" value="<?= isset($return_to) ? $return_to : '' ?>">
  39. <button class="ui fluid large teal submit button">Login</button>
  40. </div>
  41. <div class="ui error message"></div>
  42. </form>
  43. <div class="ui message">
  44. What's this? <a href="https://indielogin.com/setup">About Web Sign-In</a>
  45. </div>
  46. </div>
  47. </div>
  48. <script>
  49. /* add http:// to URL fields on blur or when enter is pressed */
  50. document.addEventListener('DOMContentLoaded', function() {
  51. function addDefaultScheme(target) {
  52. if(target.value.match(/^(?!https?:).+\..+/)) {
  53. target.value = "http://"+target.value;
  54. }
  55. }
  56. var elements = document.querySelectorAll("input[type=url]");
  57. Array.prototype.forEach.call(elements, function(el, i){
  58. el.addEventListener("blur", function(e){
  59. addDefaultScheme(e.target);
  60. });
  61. el.addEventListener("keydown", function(e){
  62. if(e.keyCode == 13) {
  63. addDefaultScheme(e.target);
  64. }
  65. });
  66. });
  67. });
  68. </script>