Skip to content

Commit

Permalink
Merge pull request #29 from opentechinstitute/Feature_585
Browse files Browse the repository at this point in the history
Feature 585 - Tested.
  • Loading branch information
jheretic committed Aug 26, 2013
2 parents a321fc5 + b1b64a4 commit e3b3650
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 24 deletions.
2 changes: 1 addition & 1 deletion usr/lib/lua/luci/controller/QS/QS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ function index()
local uci = luci.model.uci.cursor()
if uci:get('quickstart', 'options', 'complete') ~= 'true' then
entry({"QuickStart"}, call("main"), "Quick Start").dependent=false
entry({"QuickStart", "CertificateHelp"}, template("QS/module/cert"))
end
entry({"admin", "commotion", "quickstart"}, call("resetQS"), "Restart Quickstart", 50)

end

function resetQS()
Expand Down
52 changes: 29 additions & 23 deletions usr/lib/lua/luci/view/QS/module/applyreboot.htm
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<%+header%>

<html>
<head>
<title><%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Redirecting...%><% end %></title>
<title><%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Redirecting...%><% end %>
</title>
<%-
if luci.fs.isfile("/etc/commotion/profiles.d/quickstartSettings") then
for line in io.lines("/etc/commotion/profiles.d/quickstartSettings") do
Expand Down Expand Up @@ -29,23 +32,27 @@
local meshName = netName
local nodeName = hostname
-%>

<script type="text/javascript">
//<![CDATA[
var interval = window.setInterval(function() {
var img = new Image();
var interval2 = window.setInterval(function() {
window.clearInterval(interval);
window.clearInterval(interval2);
location.href = "<%=redirect_location%>";
}, 30000);
img.onload = function() {
window.clearInterval(interval);
location.href = "<%=redirect_location%>";
};
img.src = 'http://<%=addr or luci.http.getenv("SERVER_NAME")%><%=resource%>/icons/loading.gif?' + Math.random();
}, 30000);
//]]>
</script>

<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
<script type="text/javascript">//<![CDATA[
var interval = window.setInterval(function() {
var img = new Image();
var interval2 = window.setInterval(function() {
window.clearInterval(interval);
window.clearInterval(interval2);
location.href = "<%=redirect_location%>";
}, 30000);
img.onload = function() {
window.clearInterval(interval);
location.href = "<%=redirect_location%>";
};
img.src = 'http://<%=addr or luci.http.getenv("SERVER_NAME")%><%=resource%>/icons/loading.gif?' + Math.random();
}, 30000);
//]]></script>
</head>
<body>
<div id="maincontainer">
Expand All @@ -61,24 +68,23 @@ <h2><a id="content" name="content"><%:System%> - <% if title then %><%=title%><%
<%:Waiting for changes to be applied...%>
<div id="zone-content-wrapper">
<div id="zone-content">
<h3>The name of your mesh network is:</h3>
<h3><%:The name of your mesh network is:%></h3>
<p><strong><%=meshName%></strong></p>

<h3>Your node name is:</h3>
<h3><%:Your node name is:%></h3>
<p><strong><%=nodeName%></strong></p>

<h3>When people connect to your node wirelessly, they will connect using this name:</h3>
<h3><%:When people connect to your node wirelessly, they will connect using this name:%></h3>
<p><strong><%=apName%></strong></p>

<p>After configuring your node, you can change the node name on the node administration page.</p>
<p><%:After configuring your node, you can change the node name on the node administration page.%></p>
</div>
</div>
</p>
<form action="<%=redirect_location%>" type="get">
<input type="submit" value="Click here if your browser doesn't redirect you within one minute" name="action" />
</form>
</fieldset>
</div>
</div>
</body>
</html>

<%+footer%>
50 changes: 50 additions & 0 deletions usr/lib/lua/luci/view/QS/module/cert.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<%+header%>
<head>
<link rel="stylesheet" type="text/css" href="<%=media%>/QS/css/certWarn.css" />
<script type="text/javascript" src="<%=media%>/QS/css/applyreboot.js"></script>

</head>

<body>
<h1><%:Device "fingerprints" and HTTPS%></h1>
<noscript>
<p><strong><%:You appear to have Javascript disabled%></strong><br /><br /><%:The interactive portions on this page use locally hosted Javascript to walk users through manually verifying certificates on various browsers. If you are actively blocking JS, it is likely that you are already passingly familiar with this process, and the fingerprints above are all you need. If you are not, please enable Javascript in your browser or NoScript preferences to view the tutorial.%></p>
</noscript>

<p><%:We are about to open a secure connection to your device. Because this wireless device is not registered with a online certificate provider your web browser cannot verify that it is who it says it is. You can use the fingerprints below to verify this device yourself.%></p>
<div>
<p><%:This device's fingerprints are:%></p>
<ul style="list-style-type:none">
<%-
require "commotion_helpers"
md5, sha1 = ssl_cert_fingerprints()
-%>
<li><strong><%:SHA1 Fingerprint:%></strong><%=sha1%><br /></li>
<li><strong><%:MD5 Fingerprint:%></strong><%=md5%><br /></li>
</ul>
</div>
<div>
<a href="#" onclick="toggleVisibility('useThis')"><strong><%:How do I use these fingerprints?%></strong></a>
</div>

<div id="useThis" class="hidden">
<p><%:When your browser gives you a%> <a href="#" onclick="toggleVisibility('warnings')"><%:warning%></a><%:, you will be given the option to view the devices certificate.%></p>
<div id="warnings" class="hidden"><img src="<%=media%>/QS/images/alerts.png"/></div>
<p><%:Each browser uses different types of fingerprints to idenitfy a device. You can use one or both of the above fingerprints to verify that your browser is connecting to this device depending upon your browser. %></p>
<p><%:Please click on your browsers icon below for instructions on how to check this device's fingerprints.%></p>
<h3><a href="#" onclick="toggleVisibility('tutorial')"><%:Show Me How%></a></h3>
<div id="tutorial" class="hidden">
<form name="form1">
<span id="buttons">
<input type="button" class="ff_icon" id="firefoxButton" onclick="firefoxFunc()" name="firefox"/>
<input type="button" class="ie_icon" id="internetexplorerButton" onclick="internetExplorer()" name="internetexplorer"/>
<input type="button" class="chrome_icon" onclick="chromeFunc()" id="chromeButton" name="chrome"/>
</span>
</form>
<div id="certWrapper" class="hidden">
<div id="certTut" class="sprite iecert3" alt="CertificateHelp" onclick="next()"/>
</div>
</div>
</div>
</body>
<%+footer%>
4 changes: 4 additions & 0 deletions usr/lib/lua/luci/view/QS/module/name.htm
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ <h2 class="warning"><%=nameErr%></h2>
</div>
</div>
</div>
<div>
<strong><p><%:We are about to open a secure connection to your device. You WILL receive a warning from your browser.%></strong> <a href="http://<%=luci.http.getenv("SERVER_NAME")%><%=REQUEST_URI%>/CertificateHelp", target="_blank"><%:Click here to learn what this warning means.%></a></strong>
</div>
</div>
57 changes: 57 additions & 0 deletions www/luci-static/commotion/QS/css/applyreboot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var classType = "iecert";
var pageNum = 1;

function internetExplorer() {
if (document.getElementById('certWrapper').className == "hidden") {
document.getElementById("certWrapper").className = "certWrapper";
}
classType = "iecert";
pageNum = 1;
document.getElementById("certTut").className="sprite " + classType + pageNum;
};

function firefoxFunc() {
if (document.getElementById('certWrapper').className == "hidden") {
document.getElementById("certWrapper").className = "certWrapper";
}
classType = "chcert";
pageNum = 1;
document.getElementById("certTut").className="sprite " + classType + pageNum;
};

function chromeFunc() {
if (document.getElementById('certWrapper').className == "hidden") {
document.getElementById("certWrapper").className = "certWrapper";
}
classType = "ffcert";
pageNum = 1;
document.getElementById("certTut").className="sprite " + classType + pageNum;
};

function next() {
if (classType == 'ffcert' || classType == 'iecert') {
if (pageNum <= 3) {
pageNum += 1;
}
else {
pageNum = 1;
}
}
else if (classType == 'chcert') {
if (pageNum <= 2) {
pageNum += 1;
}
else {
pageNum = 1;
}
}
document.getElementById("certTut").className="sprite " + classType + pageNum;
};

function toggleVisibility(x)
{
if (document.getElementById(x).className === "hidden") {
document.getElementById(x).className = "visible";
}
else {document.getElementById(x).className = "hidden";}
}
34 changes: 34 additions & 0 deletions www/luci-static/commotion/QS/css/certWarn.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.certWrapper {height:600px;}
.hidden {display:none;}
.visible {display:true;}
.sprite {background:url(/luci-static/commotion/QS/images/certSpriteWindow.jpg);}
#firefoxButton {background: url(/luci-static/commotion/QS/images/ff_icon001.png) no-repeat; border:none; height:85px; width:85px; margin:20px;}
#internetexplorerButton {background: url(/luci-static/commotion/QS/images/ie_icon001.png) no-repeat; border:none; height:85px; width:85px; margin:20px;}
#chromeButton {background: url(/luci-static/commotion/QS/images/chrome_icon001.png) no-repeat; border:none; height:85px; width:85px; margin:20px;}

/* Firefox */
.ffcert0 {height:510px; width:900px; background-position:-64px -133px;}
.ffcert1 {height:460px; width:855px; background-position:-15px 0px;}
.ffcert2 {height:567px; width:853px; background-position:-15px -480px;}
.ffcert3 {height:520px; width:540px; background-position:-15px -1065px;}
.ffcert4 {height:550px; width:489px; background-position:-15px -1605px;}


/* Chrome */
.chcert1 {height:320px; width:890px; background-position:-900px -14px;}
.chcert2 {height:600px; width:440px; background-position:-870px -340px;}
.chcert3 {height:600px; width:575px; background-position:-1320px -375px;}


/* IE */
.iecert1 {height:350px; width:800px; background-position:-600px -1080px;}
.iecert2 {height:360px; width:380px; background-position:-1470px -1075px;}
.iecert3 {height:535px; width:440px; background-position:-640px -1525px;}
.iecert4 {height:550px; width:480px; background-position:-1150px -1530px;}

noscript p {
margin: 1em;
padding: .5em;
background: #eee;
border: 1px #999 solid;
}
Binary file added www/luci-static/commotion/QS/images/alerts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e3b3650

Please sign in to comment.