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

Commit

Permalink
Initial steps to deprecate requiredEmail.
Browse files Browse the repository at this point in the history
* include.js and dialog.js both throw a "requiredEmail has been deprecated" exception.
* remove tests for dialog.js that check requiredEmail.

issue #1760
  • Loading branch information
Shane Tomlinson committed Jun 15, 2012
1 parent 76f7a94 commit b3ea312
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 75 deletions.
13 changes: 0 additions & 13 deletions example/rp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@
<input type="checkbox" id="returnTo">
<label for="returnTo">Supply returnTo</label><br />
</li>
</li><li>
<input type="text" id="requiredEmail" width="80">
<label for="requiredEmail">Require a specific email</label><br />
</li>
</ul>
<button class="assertion">Get an assertion</button>
Expand Down Expand Up @@ -181,15 +178,6 @@ <h2>readiness</h2>

$(document).ready(function() {
$(".specify button.assertion").click(function() {
var requiredEmail = $.trim($('#requiredEmail').val());
if (!requiredEmail.length) requiredEmail = undefined;
if (requiredEmail && requiredEmail.indexOf('@') === -1) {
alert('Invalid Email in "Require a specific email" field. Adding @example.com');
$('#requiredEmail').val(requiredEmail + '@example.com');
$('#requiredEmail').focus();
return;
}

$(".specify button.assertion").attr('disabled', 'true');

navigator.id.request({
Expand All @@ -198,7 +186,6 @@ <h2>readiness</h2>
siteName: $('#siteName').attr('checked') ? "Persona Test Relying Party" : undefined,
siteLogo: $('#siteLogo').attr('checked') ? "/i/logo.png" : undefined,
returnTo: $('#returnTo').attr('checked') ? "/postVerificationReturn.html" : undefined,
requiredEmail: requiredEmail,
oncancel: function() {
loggit("oncancel");
$(".specify button.assertion").removeAttr('disabled');
Expand Down
4 changes: 1 addition & 3 deletions resources/static/dialog/controllers/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ BrowserID.Modules.Dialog = (function() {
// verify params
try {
if (paramsFromRP.requiredEmail) {
if (!bid.verifyEmail(paramsFromRP.requiredEmail))
throw "invalid requiredEmail: (" + paramsFromRP.requiredEmail + ")";
params.requiredEmail = paramsFromRP.requiredEmail;
throw "requiredEmail has been deprecated";
}

// support old parameter names...
Expand Down
4 changes: 4 additions & 0 deletions resources/static/include_js/include.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,10 @@
}

function internalRequest(options) {
if (options.requiredEmail) {
throw "requiredEmail has been deprecated";
}

// focus an existing window
if (w) {
try {
Expand Down
59 changes: 0 additions & 59 deletions resources/static/test/cases/controllers/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,65 +198,6 @@
});
});

asyncTest("get with invalid requiredEmail - 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, {
requiredEmail: "bademail"
});
equal(retval, "invalid requiredEmail: (bademail)", "expected error");
testErrorVisible();
start();
}
});
});

asyncTest("get with script containing requiredEmail - 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, {
requiredEmail: "<script>window.scriptRun=true;</script>testuser@testuser.com"
});

// If requiredEmail is not properly escaped, scriptRun will be true.
equal(typeof window.scriptRun, "undefined", "script was not run");
equal(retval, "invalid requiredEmail: (<script>window.scriptRun=true;</script>testuser@testuser.com)", "expected error");
testErrorVisible();
start();
}
});
});

asyncTest("get with valid requiredEmail - go to start", function() {
createController({
ready: function() {
var startInfo;
mediator.subscribe("start", function(msg, info) {
startInfo = info;
});

var retval = controller.get(HTTP_TEST_DOMAIN, {
requiredEmail: TESTEMAIL
});

testHelpers.testObjectValuesEqual(startInfo, {
requiredEmail: TESTEMAIL
});
equal(typeof retval, "undefined", "no error expected");
testErrorNotVisible();
start();
}
});
});

asyncTest("get with relative tosURL & valid privacyURL - print error screen", function() {
createController({
ready: function() {
Expand Down

0 comments on commit b3ea312

Please sign in to comment.