index.html 5.3 KB

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