index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Hard Drive Unlocking</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <style>
  7. body {
  8. text-align: center;
  9. font-family: sans;
  10. background-color: #f2c8ee;
  11. padding-top: 15px;
  12. }
  13. fieldset {
  14. margin: 10px auto 30px;
  15. padding: 30px;
  16. width: 50%;
  17. background-color: #fff;
  18. border: 0;
  19. border-radius: 15px;
  20. }
  21. legend {
  22. background-color: #fff;
  23. padding: 5px 17px;
  24. font-weight: bold;
  25. border-radius: 5px;
  26. text-shadow: 1px 1px rgba(0,0,0,.3);
  27. font-variant: small-caps;
  28. }
  29. input {
  30. border: 1px solid #6f1465;
  31. padding: 5px;
  32. font-size: 1em;
  33. color: #c70fb3;
  34. text-align: center;
  35. background-color: #fcf2fb;
  36. border-radius: 5px;
  37. }
  38. input[type=submit] {
  39. padding: 10px 20px;
  40. font-weight: bold;
  41. background-color: #fff;
  42. border-width: 0;
  43. font-size: 20px;
  44. }
  45. input[type=submit]:hover {
  46. background-color: #6f1465;
  47. color: #fff;
  48. cursor: pointer;
  49. }
  50. #error {
  51. color: #ca0000;
  52. font-weight: bold;
  53. }
  54. label span {
  55. cursor: pointer;
  56. }
  57. .loader {
  58. content: "";
  59. display: none;
  60. width: 0;
  61. height: 0;
  62. border: solid 25px;
  63. border-radius: 5em;
  64. border-color: #ff619c #8f9cff #f6ff60 #67ff00 ;
  65. animation: spin .3s linear infinite;
  66. }
  67. #unlocked {
  68. display: none;
  69. font-size: 4em;
  70. font-weight: bold;
  71. }
  72. #unlocked img {
  73. display: block;
  74. margin: .5em auto;
  75. }
  76. @keyframes spin {
  77. 0% {
  78. transform: rotate(0deg);
  79. }
  80. 100% {
  81. transform: rotate(360deg);
  82. }
  83. }
  84. </style>
  85. <script>
  86. var beautifulColors = [ 'ff619c', 'ffc160', 'f6ff60', '67ff00', '57f6fc', '8f9cff', 'fc57ee' ];
  87. var beautifulColorsIndex = 0;
  88. function showPassword(chk) {
  89. var pwd = document.getElementById('passphrase');
  90. pwd.type = chk.checked ? 'text' : 'password';
  91. }
  92. function focusText() {
  93. var pwd = document.getElementById('passphrase');
  94. pwd.focus();
  95. }
  96. function beautifulCycle() {
  97. if(document.getElementsByClassName('beautiful')) {
  98. setInterval(function () {
  99. var beautifuls = document.getElementsByClassName('beautiful');
  100. for(var i = 0; i < beautifuls.length; i++) {
  101. beautifuls[i].style.color = '#' + beautifulColors[beautifulColorsIndex];
  102. }
  103. beautifulColorsIndex = (beautifulColorsIndex + 1) % beautifulColors.length;
  104. }, 100);
  105. }
  106. }
  107. function showLoader() {
  108. document.getElementById('unlock').style.display = 'none';
  109. document.getElementById('loader').style.display = 'inline-block';
  110. }
  111. function unlocked() {
  112. document.getElementById('main').style.display = 'none';
  113. document.getElementById('unlocked').style.display = 'inline';
  114. }
  115. function submitForm() {
  116. showLoader();
  117. var xmlHttp = new XMLHttpRequest();
  118. xmlHttp.open('POST', document.getElementById('form').action, true);
  119. xmlHttp.onreadystatechange = function() {
  120. if(xmlHttp.readyState == 4) {
  121. if(xmlHttp.status == 200) {
  122. unlocked();
  123. } else {
  124. alert('An error occured.');
  125. }
  126. }
  127. }
  128. xmlHttp.send('passphrase=' + document.getElementById('passphrase').value);
  129. return false;
  130. }
  131. </script>
  132. </head>
  133. <body onload="beautifulCycle(); focusText()">
  134. <div id="main">
  135. <img src="unicorn.gif" alt="Beautiful Unicorn">
  136. <form method="post" id="form" action="/cgi-bin/post.sh" onsubmit="return submitForm()">
  137. <fieldset>
  138. <legend>Hard Drive Locked</legend>
  139. <!-- TPL:ERROR
  140. <p id="error" class="beautiful">
  141. Wrong passphrase. Try again, Dude!
  142. </p>
  143. TPL:ERROR -->
  144. <p>
  145. <label for="passphrase">
  146. Enter your passphrase to unlock the hard drive:
  147. </label>
  148. </p>
  149. <input type="password" name="passphrase" id="passphrase" />
  150. <p>
  151. <label>
  152. <input type="checkbox" onclick="showPassword(this)" />
  153. <span>Show passphrase</span>
  154. </label>
  155. </p>
  156. </fieldset>
  157. <input type="submit" id="unlock" value="Unlock" onclick="showLoader()" />
  158. <div class="loader" id="loader"></div>
  159. </div>
  160. <div id="unlocked" class="beautiful">
  161. <img src="unlocked.png" alt="Unlocked" />
  162. Unlocked!
  163. </div>
  164. </form>
  165. </body>
  166. </html>