From 1a7c7e553f117f1b465d44394b831019b5bb8607 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Thu, 22 Dec 2011 00:11:02 -0700
Subject: [PATCH] in-code commenting of how we manage authentication on the
 sign-up page

---
 resources/static/pages/signup.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/resources/static/pages/signup.js b/resources/static/pages/signup.js
index d293f71ab..31400aa48 100644
--- a/resources/static/pages/signup.js
+++ b/resources/static/pages/signup.js
@@ -60,8 +60,21 @@ BrowserID.signUp = (function() {
         throw "cannot verify with primary without an email address and URL"
       }
 
-      var url = verifyURL + "?email=" + encodeURIComponent(verifyEmail);
-      win.open(url, "_moz_primary_verification", "width=500, height=500");
+      var url = verifyURL + "?email=" + encodeURIComponent(verifyEmail) +
+                            "&return_to=https://browserid.org/sign_in_complete";
+      // XXX: we should use winchan (and send user to a page that redirects to primary)!
+      // we should:
+      // 1. build a page that we host and we open with winchan
+      // 2. pass that page the location to redirect the user to in-dialog
+      // 3. spawn dialog
+      // 4. page immediately redirects user to primary, passes 'email' and 'return_to' args
+      // 5. primary does thing...
+      // 6. primary redirects to our page (`return_to`)
+      // 7. return_to immediately closes after calling WinChan.onOpen()
+      // 8. we get notification that the interaction is complete in main page and try to
+      //    silently provision again!  success means the users is signed up, failure
+      //    means there was an auth problem.  they can try again?
+      win.open(url, "_moz_primary_verification", "width=700,height=375");
       oncomplete && oncomplete();
     }
 
-- 
GitLab