index.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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: #d5a6d9;
  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 = [ 'f00000', 'ff9b00', 'f4ff4d', '62ff9b', '2efff2', '1b50e4' ];
  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 hideLoader() {
  127. document.getElementById('unlock').style.display = 'inline';
  128. document.getElementById('loader').style.display = 'none';
  129. }
  130. function unlocked() {
  131. document.getElementById('main').style.display = 'none';
  132. document.getElementById('unlocked').style.display = 'block';
  133. }
  134. function failed() {
  135. document.getElementById('error').style.display = 'block';
  136. document.getElementById('mainimg').src = document.getElementById('mainimg').src.replace('caticorn', 'caticorn_failed');
  137. }
  138. function submitForm() {
  139. showLoader();
  140. var xmlHttp = new XMLHttpRequest();
  141. xmlHttp.open('POST', document.getElementById('form').action, true);
  142. xmlHttp.onreadystatechange = function() {
  143. if(xmlHttp.readyState == 4) {
  144. if(xmlHttp.responseText.match(/TPL:UNLOCKED/)) {
  145. hideLoader();
  146. failed();
  147. } else {
  148. unlocked();
  149. }
  150. }
  151. }
  152. xmlHttp.send('passphrase=' + document.getElementById('passphrase').value);
  153. return false;
  154. }
  155. function onLoadHandler() {
  156. beautifulCycle();
  157. focusText();
  158. var nojs = document.getElementsByClassName('no-js');
  159. for(var i = 0; i < nojs.length; i++) {
  160. nojs[i].className = nojs[i].className.replace('no-js', '');
  161. }
  162. }
  163. </script>
  164. </head>
  165. <body onload="onLoadHandler()">
  166. <div id="main">
  167. <img src="/caticorn.png" id="mainimg" alt="Beautiful Unicorn" />
  168. <form method="post" id="form" action="/cgi-bin/post.sh" onsubmit="return submitForm()">
  169. <fieldset>
  170. <legend>Hard Drive Locked</legend>
  171. <p id="error">
  172. Wrong passphrase. Try again?
  173. </p>
  174. <p>
  175. <label for="passphrase">
  176. Enter your passphrase to unlock the hard drive:
  177. </label>
  178. </p>
  179. <input type="password" name="passphrase" id="passphrase" />
  180. <p class="no-js">
  181. <label>
  182. <input type="checkbox" onclick="showPassword(this)" />
  183. <span>Show passphrase</span>
  184. </label>
  185. </p>
  186. </fieldset>
  187. <input type="submit" id="unlock" value="Unlock" onclick="showLoader()" />
  188. <div class="loader" id="loader"></div>
  189. </form>
  190. </div>
  191. <div id="unlocked" class="beautiful">
  192. <img src="/caticorn_success.png" alt="Unlocked" />
  193. Unlocked!
  194. </div>
  195. </body>
  196. </html>