From 2940138395168dc90c9af7a559786fab69ae4461 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Wed, 6 Apr 2011 21:42:34 -0600 Subject: [PATCH] id selection complete --- authority/jsapi/include.js | 2 ++ authority/jsapi/picker.html | 15 +++++++++------ authority/jsapi/picker.js | 35 ++++++++++++++++++++++++++++------- rp/index.html | 1 + 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/authority/jsapi/include.js b/authority/jsapi/include.js index 4f6847205..b6b46b0a8 100644 --- a/authority/jsapi/include.js +++ b/authority/jsapi/include.js @@ -530,9 +530,11 @@ if (!navigator.id.getVerifiedEmail) { method: "getVerifiedEmail", success: function(rv) { if (onsuccess) onsuccess(rv); + w.close(); }, error: function(code, msg) { if (onerror) onerror(code, msg); + w.close(); } }); }; diff --git a/authority/jsapi/picker.html b/authority/jsapi/picker.html index 1270a6609..988323c49 100644 --- a/authority/jsapi/picker.html +++ b/authority/jsapi/picker.html @@ -1,13 +1,16 @@ <html> -<body> -<p>Hi! Want to log into [sitename]?</p> +<head> + <title> Mozilla ID </title> + <style> + body { display: none } + </style> +</head> +<body id="body"> +<p>Hi! Want to log into <span id="sitename"></span>?</p> <p> Which ID would you like to use? </p> -<ul> - <li> <a href="#">AAA</a> - <li> <a href="#">BBB</a> - <li> <a href="#">AAA</a> +<ul id="availableIdentities"> </ul> <script src="jschannel.js"></script> diff --git a/authority/jsapi/picker.js b/authority/jsapi/picker.js index 8af5b3b0a..4339e0bb0 100644 --- a/authority/jsapi/picker.js +++ b/authority/jsapi/picker.js @@ -2,14 +2,35 @@ // fiddles the dom expressed by picker.html var chan = Channel.build( - { - window: window.opener, - origin: "*", - scope: "mozid" + { + window: window.opener, + origin: "*", + scope: "mozid" + }); - }); chan.bind("getVerifiedEmail", function(trans, s) { - alert("you called getVerifiedEmail"); - return "AAA"; + trans.delayReturn(true); + + // set the requesting site + document.getElementById("sitename").innerText = trans.origin.replace(/^.*:\/\//, ""); + + // iterate over all of the available identities and add a links to them + // XXX -- actually pull these guys outta localStorage + + var list = document.getElementById('availableIdentities'); + [ "foo@bar.com", "baz@bing.com" ].forEach(function(i) { + var li = document.createElement("li"); + var link = document.createElement("a"); + link.innerText = i; + link.href = "#"; + li.appendChild(link); + link.addEventListener("click", function(evt) { + trans.complete(this.innerText); + }); + list.appendChild(li); + }); + + // now let's make the body visible + document.getElementById("body").style.display = "block"; }); diff --git a/rp/index.html b/rp/index.html index 26523881c..6802e9b31 100644 --- a/rp/index.html +++ b/rp/index.html @@ -27,6 +27,7 @@ computer usage for little ones. // // Now we'll send this assertion up to the mywords server for // validation + console.log("got assertion: " + assertion); $.post( '/login', -- GitLab