Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
TOS/PP rebase with dev, cleanup
Browse files Browse the repository at this point in the history
* Rename tosURL/privacyURL to termsOfService and privacyPolicy universally.
* Clean up styles as Skinny suggests.
* Remove dead code from pick_email.js

issue #1240
  • Loading branch information
Shane Tomlinson committed Jun 11, 2012
1 parent 34a4335 commit c88896d
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 63 deletions.
4 changes: 2 additions & 2 deletions resources/static/dialog/controllers/dialog.js
Expand Up @@ -165,8 +165,8 @@ BrowserID.Modules.Dialog = (function() {
if (paramsFromRP.privacyURL) paramsFromRP.privacyPolicy = paramsFromRP.privacyURL;

if (paramsFromRP.termsOfService && paramsFromRP.privacyPolicy) {
params.tosURL = fixupURL(origin_url, paramsFromRP.termsOfService);
params.privacyURL = fixupURL(origin_url, paramsFromRP.privacyPolicy);
params.termsOfService = fixupURL(origin_url, paramsFromRP.termsOfService);
params.privacyPolicy = fixupURL(origin_url, paramsFromRP.privacyPolicy);
}

if (paramsFromRP.siteLogo) {
Expand Down
4 changes: 1 addition & 3 deletions resources/static/dialog/controllers/pick_email.js
Expand Up @@ -96,9 +96,7 @@ BrowserID.Modules.PickEmail = (function() {

self.renderDialog("pick_email", {
identities: identities,
siteemail: originEmail,
privacy_url: options.privacyURL,
tos_url: options.tosURL
siteemail: originEmail
});

// If the user has been to this site before, they have already implicitly
Expand Down
4 changes: 2 additions & 2 deletions resources/static/dialog/controllers/rp_info.js
Expand Up @@ -34,8 +34,8 @@ BrowserID.Modules.RPInfo = (function() {
hostname: options.hostname,
siteName: options.siteName,
siteLogo: options.siteLogo,
privacyURL: options.privacyURL,
tosURL: options.tosURL
privacyPolicy: options.privacyPolicy,
termsOfService: options.termsOfService
});

sc.start.call(this, options);
Expand Down
7 changes: 4 additions & 3 deletions resources/static/dialog/css/popup.css
Expand Up @@ -291,17 +291,16 @@ section > .contents {
#favicon h2, #favicon h3 {
white-space: nowrap;
text-overflow: ellipsis;
font-size: 28px;
line-height: 1.2em; /* the 1.2em is to keep y, g, j, etc from having their bottoms chopped off */
overflow: hidden;
margin: 10px 0 0 0;
}

#favicon h2 {
margin: 10px 0 0 0;
font-size: 28px;
}

#favicon h3 {
margin-top: 0;
font-size: 14px;
}

Expand Down Expand Up @@ -398,6 +397,7 @@ div#required_email {
display: none;
font-size: 11px;
line-height: 1.2;
color: #787878;
}

#rp_info .tospp {
Expand Down Expand Up @@ -441,6 +441,7 @@ a.emphasize:active {
#back {
color: #000;
border-bottom: 1px dotted;
font-weight: normal;
}

.submit > button {
Expand Down
18 changes: 8 additions & 10 deletions resources/static/dialog/views/rp_info.ejs
Expand Up @@ -11,20 +11,18 @@
<h2 id="rp_name"><%= siteName %></h2>
<% } %>

<% if(hostname) { %>
<% if(siteName) { %>
<h3 id="rp_hostname"><%= hostname %></h3>
<% } else { %>
<h2 id="rp_hostname"><%= hostname %></h2>
<% } %>
<% if(siteName) { %>
<h3 id="rp_hostname"><%= hostname %></h3>
<% } else { %>
<h2 id="rp_hostname"><%= hostname %></h2>
<% } %>

<% if(privacyURL && tosURL) { %>
<% if(privacyPolicy && termsOfService) { %>
<p class="rptospp tospp">
<%= format(gettext("By proceeding, you agree to %s\'s <a %s>Terms</a> and <a %s>Privacy Policy</a>."),
[ sitename,
' href="' + tosURL + '" id="rp_tos" target="_blank"',
' href="' + privacyURL + '" id="rp_pp" target="_blank"'
[ siteName || hostname,
' href="' + termsOfService + '" id="rp_tos" target="_blank"',
' href="' + privacyPolicy + '" id="rp_pp" target="_blank"'
]) %>
</p>
<% } %>
78 changes: 39 additions & 39 deletions resources/static/test/cases/controllers/dialog.js
Expand Up @@ -257,16 +257,16 @@
});
});

asyncTest("get with relative tosURL & valid privacyURL - print error screen", function() {
asyncTest("get with relative termsOfService & valid privacyPolicy - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "relative.html",
privacyURL: "/privacy.html"
termsOfService: "relative.html",
privacyPolicy: "/privacy.html"
});
equal(retval, "relative urls not allowed: (relative.html)", "expected error");
testErrorVisible();
Expand All @@ -275,19 +275,19 @@
});
});

asyncTest("get with script containing tosURL - print error screen", function() {
asyncTest("get with script containing termsOfService - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "relative.html<script>window.scriptRun=true;</script>",
privacyURL: "/privacy.html"
termsOfService: "relative.html<script>window.scriptRun=true;</script>",
privacyPolicy: "/privacy.html"
});

// If tosURL is not properly escaped, scriptRun will be true.
// If termsOfService is not properly escaped, scriptRun will be true.
equal(typeof window.scriptRun, "undefined", "script was not run");
equal(retval, "relative urls not allowed: (relative.html<script>window.scriptRun=true;</script>)", "expected error");
testErrorVisible();
Expand All @@ -296,16 +296,16 @@
});
});

asyncTest("get with valid tosURL & relative privacyURL - print error screen", function() {
asyncTest("get with valid termsOfService & relative privacyPolicy - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "/tos.html",
privacyURL: "relative.html"
termsOfService: "/tos.html",
privacyPolicy: "relative.html"
});
equal(retval, "relative urls not allowed: (relative.html)", "expected error");
testErrorVisible();
Expand All @@ -314,19 +314,19 @@
});
});

asyncTest("get with script containing privacyURL - print error screen", function() {
asyncTest("get with script containing privacyPolicy - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "/tos.html",
privacyURL: "relative.html<script>window.scriptRun=true;</script>"
termsOfService: "/tos.html",
privacyPolicy: "relative.html<script>window.scriptRun=true;</script>"
});

// If privacyURL is not properly escaped, scriptRun will be true.
// If privacyPolicy is not properly escaped, scriptRun will be true.
equal(typeof window.scriptRun, "undefined", "script was not run");
equal(retval, "relative urls not allowed: (relative.html<script>window.scriptRun=true;</script>)", "expected error");
testErrorVisible();
Expand All @@ -335,19 +335,19 @@
});
});

asyncTest("get with privacyURL - print error screen", function() {
asyncTest("get with privacyPolicy - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "/tos.html",
privacyURL: "relative.html<script>window.scriptRun=true;</script>"
termsOfService: "/tos.html",
privacyPolicy: "relative.html<script>window.scriptRun=true;</script>"
});

// If privacyURL is not properly escaped, scriptRun will be true.
// If privacyPolicy is not properly escaped, scriptRun will be true.
equal(typeof window.scriptRun, "undefined", "script was not run");
equal(retval, "relative urls not allowed: (relative.html<script>window.scriptRun=true;</script>)", "expected error");
testErrorVisible();
Expand All @@ -356,16 +356,16 @@
});
});

asyncTest("get with javascript protocol for privacyURL - print error screen", function() {
asyncTest("get with javascript protocol for privacyPolicy - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "/tos.html",
privacyURL: "javascript:alert(1)"
termsOfService: "/tos.html",
privacyPolicy: "javascript:alert(1)"
});

equal(retval, "relative urls not allowed: (javascript:alert(1))", "expected error");
Expand All @@ -375,16 +375,16 @@
});
});

asyncTest("get with invalid httpg protocol for privacyURL - print error screen", function() {
asyncTest("get with invalid httpg protocol for privacyPolicy - print error screen", function() {
createController({
ready: function() {
mediator.subscribe("start", function(msg, info) {
ok(false, "start should not have been called");
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "/tos.html",
privacyURL: "httpg://testdomain.com/privacy.html"
termsOfService: "/tos.html",
privacyPolicy: "httpg://testdomain.com/privacy.html"
});

equal(retval, "relative urls not allowed: (httpg://testdomain.com/privacy.html)", "expected error");
Expand All @@ -395,7 +395,7 @@
});


asyncTest("get with valid absolute tosURL & privacyURL - go to start", function() {
asyncTest("get with valid absolute termsOfService & privacyPolicy - go to start", function() {
createController({
ready: function() {
var startInfo;
Expand All @@ -404,13 +404,13 @@
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: "/tos.html",
privacyURL: "/privacy.html"
termsOfService: "/tos.html",
privacyPolicy: "/privacy.html"
});

testHelpers.testObjectValuesEqual(startInfo, {
tosURL: HTTP_TEST_DOMAIN + "/tos.html",
privacyURL: HTTP_TEST_DOMAIN + "/privacy.html"
termsOfService: HTTP_TEST_DOMAIN + "/tos.html",
privacyPolicy: HTTP_TEST_DOMAIN + "/privacy.html"
});

equal(typeof retval, "undefined", "no error expected");
Expand All @@ -420,7 +420,7 @@
});
});

asyncTest("get with valid fully qualified http tosURL & privacyURL - go to start", function() {
asyncTest("get with valid fully qualified http termsOfService & privacyPolicy - go to start", function() {
createController({
ready: function() {
var startInfo;
Expand All @@ -429,13 +429,13 @@
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: HTTP_TEST_DOMAIN + "/tos.html",
privacyURL: HTTP_TEST_DOMAIN + "/privacy.html"
termsOfService: HTTP_TEST_DOMAIN + "/tos.html",
privacyPolicy: HTTP_TEST_DOMAIN + "/privacy.html"
});

testHelpers.testObjectValuesEqual(startInfo, {
tosURL: HTTP_TEST_DOMAIN + "/tos.html",
privacyURL: HTTP_TEST_DOMAIN + "/privacy.html"
termsOfService: HTTP_TEST_DOMAIN + "/tos.html",
privacyPolicy: HTTP_TEST_DOMAIN + "/privacy.html"
});

equal(typeof retval, "undefined", "no error expected");
Expand All @@ -446,7 +446,7 @@
});


asyncTest("get with valid fully qualified https tosURL & privacyURL - go to start", function() {
asyncTest("get with valid fully qualified https termsOfService & privacyPolicy - go to start", function() {
createController({
ready: function() {
var startInfo;
Expand All @@ -455,13 +455,13 @@
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
tosURL: HTTPS_TEST_DOMAIN + "/tos.html",
privacyURL: HTTPS_TEST_DOMAIN + "/privacy.html"
termsOfService: HTTPS_TEST_DOMAIN + "/tos.html",
privacyPolicy: HTTPS_TEST_DOMAIN + "/privacy.html"
});

testHelpers.testObjectValuesEqual(startInfo, {
tosURL: HTTPS_TEST_DOMAIN + "/tos.html",
privacyURL: HTTPS_TEST_DOMAIN + "/privacy.html"
termsOfService: HTTPS_TEST_DOMAIN + "/tos.html",
privacyPolicy: HTTPS_TEST_DOMAIN + "/privacy.html"
});
equal(typeof retval, "undefined", "no error expected");
testErrorNotVisible();
Expand Down
8 changes: 4 additions & 4 deletions resources/static/test/cases/controllers/rp_info.js
Expand Up @@ -87,11 +87,11 @@
equal($("#rp_logo").attr("src"), RP_HTTPS_LOGO, "rp logo shown");
});

test("privacyURL, tosURL, nextText specified - show TOS/PP info with nextText inserted", function() {
test("privacyPolicy, termsOfService specified - show TOS/PP info", function() {
createController({
name: RP_NAME,
privacyURL: RP_PP_URL,
tosURL: RP_TOS_URL
siteName: RP_NAME,
privacyPolicy: RP_PP_URL,
termsOfService: RP_TOS_URL
});

equal($("#rp_name").text(), RP_NAME, "RP's name is set");
Expand Down

0 comments on commit c88896d

Please sign in to comment.