Advertisement
Guest User

Untitled

a guest
Feb 1st, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1.  
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  3. <html>
  4. <head>
  5. <title>Login</title>
  6.  
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. <meta http-equiv="Pragma" content="no-cache">
  9. <meta http-equiv="Expires" content="0">
  10. <meta http-equiv="Cache-Control" content="no-cache">
  11.  
  12. <link rel="shortcut icon" href="/150327.2057/images/favicon.ico">
  13. <link type="text/css" href="css/style.css" rel="stylesheet"/>
  14.  
  15. <script type="text/javascript" src="/150327.2057/js/01_libs/15_jquery-1.7.1.js"></script>
  16.  
  17. <script>
  18. var pageRenderData = null;
  19.  
  20. function appendScript(url) {
  21. var script = document.createElement('script');
  22. script.type = 'text/javascript';
  23. script.src = url;
  24. $("body").append(script);
  25. }
  26.  
  27. // TODO: just a stub. Will be replaced by real function in the new ui
  28. function jsTranslate(text) {
  29. return text;
  30. }
  31.  
  32. // Button click emulation on enter key press.
  33. // Replaces default built-in when button was a part of the form
  34. $(document).bind('keypress', function(e) {
  35. if(e.keyCode == 13){
  36. $('#loginButton').trigger('click');
  37. }
  38. });
  39.  
  40. $(window).load(function(){
  41. // Get data that is needed to properly render the page
  42. $.ajax({
  43. url: "/login.cgi",
  44. type: "get",
  45. datatype:"json",
  46. success: function(response) {
  47. if (response != null) {
  48. pageRenderData = response;
  49. updatePage();
  50. }
  51. }
  52. });
  53.  
  54. // l10n
  55. document.title = jsTranslate('Login');
  56. $("label[for='username']").text(jsTranslate('Username:'));
  57. $("label[for='password']").text(jsTranslate('Password:'));
  58. $("#loginButton").html(jsTranslate('Login'));
  59. })
  60.  
  61. $(document).ready(function() {
  62. $("#username").focus();
  63. });
  64.  
  65. function updatePage() {
  66. if (pageRenderData != null && pageRenderData.shortname != null) {
  67. $("#logo").attr("src", "images/" + pageRenderData.shortname + ".png");
  68. }
  69.  
  70. if (pageRenderData != null && pageRenderData.feature_wifi == 1) {
  71. if (pageRenderData['setup.init'] != null && pageRenderData['setup.init'] == 0) {
  72. appendScript("/150327.2057/js/01_libs/05_util.js");
  73.  
  74. if ((window.location.href.indexOf("config.uvc") == -1)
  75. && (!window.location.href.match(url_ip_reg))) {
  76. window.location.replace("http://config.uvc");
  77. }
  78. }
  79. }
  80. }
  81.  
  82. function getCookie(name) {
  83. var value = "; " + document.cookie;
  84. var parts = value.split("; " + name + "=");
  85. if (parts.length == 2) return parts.pop().split(";").shift();
  86. }
  87.  
  88. function getParameterByName(name) {
  89. name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
  90. var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
  91. results = regex.exec(location.search);
  92. return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  93. }
  94.  
  95. function doLogin(firstRun) {
  96. return $.ajax({
  97. url: "/login.cgi",
  98. type: "post",
  99. datatype:"json",
  100. data: {'username': $('input[id=username]').val(),'password': $('input[id=password]').val(),
  101. 'AIROS_SESSIONID': getCookie('AIROS_SESSIONID'), 'uri': $('input[id=uri]').val()},
  102.  
  103. success: function(response) {
  104. if (firstRun) { return; }
  105.  
  106. if (response != null && response.status != null) {
  107. if (response.status == "ok") {
  108. window.location.replace(response.location);
  109. } else if (response.status == "passwd-auth failed") {
  110. $("#errmsgtext").text("Invalid credentials.");
  111. } else {
  112. window.location.replace("/login.html");
  113. }
  114. } else {
  115. window.location.replace("/login.html");
  116. }
  117. }
  118. });
  119. }
  120.  
  121. $(function() {
  122. $('#loginButton').click(function(){
  123. uri = getParameterByName('uri');
  124. if (uri == null) {
  125. uri = '/';
  126. }
  127.  
  128. $.when(doLogin(true)).done(function() {
  129. doLogin(false);
  130. });
  131. });
  132. });
  133. </script>
  134.  
  135. <style type="text/css">
  136. #loginform {
  137. text-align: center;
  138. }
  139.  
  140. #loginform table {
  141. width: 250px;
  142. margin: 0px auto;
  143. text-align: left;
  144. }
  145.  
  146. #loginform table tr {
  147. }
  148.  
  149. table.loginsubtable {
  150. margin: 80px auto;
  151. }
  152.  
  153. table.loginsubtable td {
  154. padding: 20px 30px 0px 30px;
  155. }
  156.  
  157. table.loginsubtable img {
  158. border: 0px;
  159. }
  160.  
  161. .loginsep {
  162. border-left: 1px solid #8bbbd7;
  163. }
  164.  
  165. .loginsep table td {
  166. margin: 4px 2px 0px 2px;
  167. white-space: nowrap;
  168. padding: 5px 2px 0px 2px;
  169. }
  170.  
  171. .loginsep label {
  172. text-align: right;
  173. color: white;
  174. font-weight: normal;
  175. white-space: nowrap;
  176. }
  177.  
  178. .loginsep table td.submit {
  179. text-align: right;
  180. }
  181.  
  182. #submit {
  183. text-align: center;
  184. }
  185.  
  186. .error {
  187. color: #f4324f;
  188. font-weight: normal;
  189. white-space: nowrap;
  190. }
  191.  
  192. .license {
  193. white-space: normal;
  194. text-align: justify;
  195. line-height: 1.8em;
  196. width: 250px;
  197. }
  198.  
  199. .error {
  200. text-align: left;
  201. white-space: normal;
  202. }
  203.  
  204. </style>
  205.  
  206. </head>
  207. <body>
  208. <table border="0" cellpadding="0" cellspacing="0" align="center" class="loginsubtable">
  209. <tr>
  210. <td valign="top" style="padding-top: 50px"><img id="logo" src=""/></td>
  211. <td class="loginsep">
  212. <table border="0" cellpadding="0" cellspacing="0" class="logintable" align="center">
  213. <tr>
  214. <td colspan="2" align="center">
  215. <div id="errmsg" class="error">
  216. <span id="errmsgtext"></span>
  217. </div>
  218. </td>
  219. </tr>
  220. <tr>
  221. <td colspan="2">&nbsp;</td>
  222. </tr>
  223. <tr>
  224. <td><label for="username">Username:</label></td>
  225. <td><input type="text" name="username" id="username" /></td>
  226. </tr>
  227. <tr>
  228. <td><label for="password">Password:</label></td>
  229. <td><input type="password" name="password" id="password" maxlength="64"/></td>
  230. </tr>
  231. <tr>
  232. <td colspan="2">&nbsp;</td>
  233. </tr>
  234. </table>
  235. </td>
  236. </tr>
  237. <tr>
  238. <td>
  239. </td>
  240. <td class="submit" align="right">
  241. <button id="loginButton">Login</button>
  242. </td>
  243. </tr>
  244. </table>
  245. </body>
  246. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement