Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Login</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="Pragma" content="no-cache">
- <meta http-equiv="Expires" content="0">
- <meta http-equiv="Cache-Control" content="no-cache">
- <link rel="shortcut icon" href="/150327.2057/images/favicon.ico">
- <link type="text/css" href="css/style.css" rel="stylesheet"/>
- <script type="text/javascript" src="/150327.2057/js/01_libs/15_jquery-1.7.1.js"></script>
- <script>
- var pageRenderData = null;
- function appendScript(url) {
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = url;
- $("body").append(script);
- }
- // TODO: just a stub. Will be replaced by real function in the new ui
- function jsTranslate(text) {
- return text;
- }
- // Button click emulation on enter key press.
- // Replaces default built-in when button was a part of the form
- $(document).bind('keypress', function(e) {
- if(e.keyCode == 13){
- $('#loginButton').trigger('click');
- }
- });
- $(window).load(function(){
- // Get data that is needed to properly render the page
- $.ajax({
- url: "/login.cgi",
- type: "get",
- datatype:"json",
- success: function(response) {
- if (response != null) {
- pageRenderData = response;
- updatePage();
- }
- }
- });
- // l10n
- document.title = jsTranslate('Login');
- $("label[for='username']").text(jsTranslate('Username:'));
- $("label[for='password']").text(jsTranslate('Password:'));
- $("#loginButton").html(jsTranslate('Login'));
- })
- $(document).ready(function() {
- $("#username").focus();
- });
- function updatePage() {
- if (pageRenderData != null && pageRenderData.shortname != null) {
- $("#logo").attr("src", "images/" + pageRenderData.shortname + ".png");
- }
- if (pageRenderData != null && pageRenderData.feature_wifi == 1) {
- if (pageRenderData['setup.init'] != null && pageRenderData['setup.init'] == 0) {
- appendScript("/150327.2057/js/01_libs/05_util.js");
- if ((window.location.href.indexOf("config.uvc") == -1)
- && (!window.location.href.match(url_ip_reg))) {
- window.location.replace("http://config.uvc");
- }
- }
- }
- }
- function getCookie(name) {
- var value = "; " + document.cookie;
- var parts = value.split("; " + name + "=");
- if (parts.length == 2) return parts.pop().split(";").shift();
- }
- function getParameterByName(name) {
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
- var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
- results = regex.exec(location.search);
- return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
- }
- function doLogin(firstRun) {
- return $.ajax({
- url: "/login.cgi",
- type: "post",
- datatype:"json",
- data: {'username': $('input[id=username]').val(),'password': $('input[id=password]').val(),
- 'AIROS_SESSIONID': getCookie('AIROS_SESSIONID'), 'uri': $('input[id=uri]').val()},
- success: function(response) {
- if (firstRun) { return; }
- if (response != null && response.status != null) {
- if (response.status == "ok") {
- window.location.replace(response.location);
- } else if (response.status == "passwd-auth failed") {
- $("#errmsgtext").text("Invalid credentials.");
- } else {
- window.location.replace("/login.html");
- }
- } else {
- window.location.replace("/login.html");
- }
- }
- });
- }
- $(function() {
- $('#loginButton').click(function(){
- uri = getParameterByName('uri');
- if (uri == null) {
- uri = '/';
- }
- $.when(doLogin(true)).done(function() {
- doLogin(false);
- });
- });
- });
- </script>
- <style type="text/css">
- #loginform {
- text-align: center;
- }
- #loginform table {
- width: 250px;
- margin: 0px auto;
- text-align: left;
- }
- #loginform table tr {
- }
- table.loginsubtable {
- margin: 80px auto;
- }
- table.loginsubtable td {
- padding: 20px 30px 0px 30px;
- }
- table.loginsubtable img {
- border: 0px;
- }
- .loginsep {
- border-left: 1px solid #8bbbd7;
- }
- .loginsep table td {
- margin: 4px 2px 0px 2px;
- white-space: nowrap;
- padding: 5px 2px 0px 2px;
- }
- .loginsep label {
- text-align: right;
- color: white;
- font-weight: normal;
- white-space: nowrap;
- }
- .loginsep table td.submit {
- text-align: right;
- }
- #submit {
- text-align: center;
- }
- .error {
- color: #f4324f;
- font-weight: normal;
- white-space: nowrap;
- }
- .license {
- white-space: normal;
- text-align: justify;
- line-height: 1.8em;
- width: 250px;
- }
- .error {
- text-align: left;
- white-space: normal;
- }
- </style>
- </head>
- <body>
- <table border="0" cellpadding="0" cellspacing="0" align="center" class="loginsubtable">
- <tr>
- <td valign="top" style="padding-top: 50px"><img id="logo" src=""/></td>
- <td class="loginsep">
- <table border="0" cellpadding="0" cellspacing="0" class="logintable" align="center">
- <tr>
- <td colspan="2" align="center">
- <div id="errmsg" class="error">
- <span id="errmsgtext"></span>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2"> </td>
- </tr>
- <tr>
- <td><label for="username">Username:</label></td>
- <td><input type="text" name="username" id="username" /></td>
- </tr>
- <tr>
- <td><label for="password">Password:</label></td>
- <td><input type="password" name="password" id="password" maxlength="64"/></td>
- </tr>
- <tr>
- <td colspan="2"> </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- </td>
- <td class="submit" align="right">
- <button id="loginButton">Login</button>
- </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement