index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. display: none;
  52. /* TPL:ERROR
  53. display: block;
  54. TPL:ERROR */
  55. color: #ca0000;
  56. font-weight: bold;
  57. }
  58. label span {
  59. cursor: pointer;
  60. }
  61. .loader {
  62. content: "";
  63. display: none;
  64. width: 0;
  65. height: 0;
  66. border: solid 25px;
  67. border-radius: 5em;
  68. border-color: #ff619c #8f9cff #f6ff60 #67ff00 ;
  69. animation: spin .3s linear infinite;
  70. }
  71. #main {
  72. /* TPL:UNLOCKED
  73. display: none;
  74. TPL:UNLOCKED */
  75. }
  76. #unlocked {
  77. display: none; /* TPL:UNLOCKED */
  78. font-size: 6em;
  79. font-weight: bold;
  80. }
  81. #unlocked img {
  82. display: block;
  83. margin: .6em auto;
  84. }
  85. .no-js {
  86. display: none;
  87. }
  88. @keyframes spin {
  89. 0% {
  90. transform: rotate(0deg);
  91. }
  92. 100% {
  93. transform: rotate(360deg);
  94. }
  95. }
  96. #maintop {
  97. display: none;
  98. }
  99. </style>
  100. <script>
  101. var beautifulColors = [ 'ff619c', 'ffc160', 'f6ff60', '67ff00', '57f6fc', '8f9cff', 'fc57ee' ];
  102. var beautifulColorsIndex = 0;
  103. function showPassword(chk) {
  104. var pwd = document.getElementById('passphrase');
  105. pwd.type = chk.checked ? 'text' : 'password';
  106. }
  107. function focusText() {
  108. var pwd = document.getElementById('passphrase');
  109. pwd.focus();
  110. }
  111. function beautifulCycle() {
  112. if(document.getElementsByClassName('beautiful')) {
  113. setInterval(function () {
  114. var beautifuls = document.getElementsByClassName('beautiful');
  115. for(var i = 0; i < beautifuls.length; i++) {
  116. beautifuls[i].style.color = '#' + beautifulColors[beautifulColorsIndex];
  117. }
  118. beautifulColorsIndex = (beautifulColorsIndex + 1) % beautifulColors.length;
  119. }, 100);
  120. }
  121. }
  122. function showLoader() {
  123. document.getElementById('unlock').style.display = 'none';
  124. document.getElementById('loader').style.display = 'inline-block';
  125. }
  126. function unlocked() {
  127. document.getElementById('main').style.display = 'none';
  128. document.getElementById('unlocked').style.display = 'block';
  129. }
  130. function failed() {
  131. document.getElementById('error').style.display = 'block';
  132. }
  133. function submitForm() {
  134. showLoader();
  135. var xmlHttp = new XMLHttpRequest();
  136. xmlHttp.open('POST', document.getElementById('form').action, true);
  137. xmlHttp.onreadystatechange = function() {
  138. if(xmlHttp.readyState == 4) {
  139. if(xmlHttp.responseText.match(/TPL:UNLOCKED/)) {
  140. failed();
  141. } else {
  142. unlocked();
  143. }
  144. }
  145. }
  146. xmlHttp.send('passphrase=' + document.getElementById('passphrase').value);
  147. return false;
  148. }
  149. function onLoadHandler() {
  150. beautifulCycle();
  151. focusText();
  152. var nojs = document.getElementsByClassName('no-js');
  153. for(var i = 0; i < nojs.length; i++) {
  154. nojs[i].className = nojs[i].className.replace('no-js', '');
  155. }
  156. }
  157. </script>
  158. </head>
  159. <body onload="onLoadHandler()">
  160. <div id="main">
  161. <img src="/unicorn.gif" alt="Beautiful Unicorn">
  162. <form method="post" id="form" action="/cgi-bin/post.sh" onsubmit="return submitForm()">
  163. <fieldset>
  164. <legend>Hard Drive Locked</legend>
  165. <p id="error" class="beautiful">
  166. Wrong passphrase. Try again, Dude!
  167. </p>
  168. <p>
  169. <label for="passphrase">
  170. Enter your passphrase to unlock the hard drive:
  171. </label>
  172. </p>
  173. <input type="password" name="passphrase" id="passphrase" />
  174. <p class="no-js">
  175. <label>
  176. <input type="checkbox" onclick="showPassword(this)" />
  177. <span>Show passphrase</span>
  178. </label>
  179. </p>
  180. </fieldset>
  181. <input type="submit" id="unlock" value="Unlock" onclick="showLoader()" />
  182. <div class="loader" id="loader"></div>
  183. </form>
  184. </div>
  185. <div id="unlocked" class="beautiful">
  186. <img src="/unlocked.gif" alt="Unlocked" />
  187. Unlocked!
  188. </div>
  189. </body>
  190. </html>