diff --git a/resources/static/dialog/controllers/required_email.js b/resources/static/dialog/controllers/required_email.js
index b7754ca1824778f9ac4b3d03df327fc7d07234bb..cd83eda405a2eb22c33587438f5665d85328215a 100644
--- a/resources/static/dialog/controllers/required_email.js
+++ b/resources/static/dialog/controllers/required_email.js
@@ -129,25 +129,36 @@ BrowserID.Modules.RequiredEmail = (function() {
         // (without a password). Otherwise, make the user verify the address
         // (which shows no password).
         var userOwnsEmail = !!user.getStoredEmailKeypair(email);
-        showTemplate(userOwnsEmail, false);
+        showTemplate({
+          signin: userOwnsEmail,
+          showPassword: false
+        });
         ready();
       }
       else {
-        user.isEmailRegistered(email, function(registered) {
-          // If the current email address is registered but the user is not
-          // authenticated, make them sign in with it.  Otherwise, make them
-          // verify ownership of the address.
-          showTemplate(registered, registered);
-          ready();
-        }, self.getErrorDialog(errors.isEmailRegistered, ready));
+        user.addressInfo(email, function(info) {
+          if(info.type === "primary") {
+            // For a primary, they should authenticate with the IdP, the normal
+            // process will take care of the rest.
+            self.close("primary_user", _.extend(info, { email: email }));
+            ready();
+          }
+          else {
+            var registered = info.known;
+            // If the current email address is registered but the user is not
+            // authenticated, make them sign in with it.  Otherwise, make them
+            // verify ownership of the address.
+            showTemplate({
+              signin: registered,
+              showPassword: registered
+            });
+            ready();
+          }
+        }, self.getErrorDialog(errors.addressInfo, ready));
       }
 
-      function showTemplate(requireSignin, showPassword) {
-        self.renderDialog("required_email", {
-          email: email,
-          signin: requireSignin,
-          showPassword: showPassword
-        });
+      function showTemplate(options) {
+        self.renderDialog("required_email", _.extend({email: email}, options));
 
         self.bind("#sign_in", "click", cancelEvent(signIn));
         self.bind("#verify_address", "click", cancelEvent(verifyAddress));
diff --git a/resources/static/shared/user.js b/resources/static/shared/user.js
index 4c788d6f6b845a84d33c3e37043933ad47c5ad01..0380ba78a4299cac74924f39d958c56a1b24ea35 100644
--- a/resources/static/shared/user.js
+++ b/resources/static/shared/user.js
@@ -193,7 +193,7 @@ BrowserID.User = (function() {
     });
 
     storage.addEmail(email, email_obj);
-    if(onComplete) onComplete(true);
+    if (onComplete) onComplete(true);
   }
 
   /**
@@ -223,12 +223,12 @@ BrowserID.User = (function() {
       type: type
     });
 
-    if(onComplete) onComplete(true);
+    if (onComplete) onComplete(true);
   }
 
   User = {
     init: function(config) {
-      if(config.provisioning) {
+      if (config.provisioning) {
         provisioning = config.provisioning;
       }
     },
@@ -334,7 +334,7 @@ BrowserID.User = (function() {
         }
         else {
           self.createSecondaryUser(email, function(success) {
-            if(success) {
+            if (success) {
               onComplete("secondary.verify");
             }
             else {
@@ -346,9 +346,9 @@ BrowserID.User = (function() {
 
       function attemptAddPrimary(email, info) {
         User.provisionPrimaryUser(email, info, function(status, provInfo) {
-          if(status === "primary.verified") {
+          if (status === "primary.verified") {
             network.authenticateWithAssertion(email, provInfo.assertion, function(status) {
-              if(status) {
+              if (status) {
                 onComplete("primary.verified");
               }
               else {
@@ -377,7 +377,7 @@ BrowserID.User = (function() {
         persistEmailKeypair(email, "primary", keypair, cert, function() {
           // We are getting an assertion for browserid.org.
           User.getAssertion(email, "https://browserid.org", function(assertion) {
-            if(assertion) {
+            if (assertion) {
               onComplete("primary.verified", {
                 assertion: assertion
               });
@@ -389,7 +389,7 @@ BrowserID.User = (function() {
           }, onFailure);
         }, onFailure);
       }, function(error) {
-        if(error.code === "primaryError" && error.msg === "user is not authenticated as target user") {
+        if (error.code === "primaryError" && error.msg === "user is not authenticated as target user") {
           onComplete("primary.verify", info);
         }
         else {
@@ -645,16 +645,16 @@ BrowserID.User = (function() {
      * @method authenticate
      * @param {string} email - Email address to authenticate.
      * @param {string} password - Password.
-     * @param {function} [onComplete] - Called on sync completion.
+     * @param {function} [onComplete] - Called on completion with status. true
+     * if user is authenticated, false otw.
      * @param {function} [onFailure] - Called on error.
      */
     authenticate: function(email, password, onComplete, onFailure) {
       var self=this;
       network.authenticate(email, password, function(authenticated) {
         setAuthenticationStatus(authenticated);
-        if (onComplete) {
+        if (onComplete)
           onComplete(authenticated);
-        }
       }, onFailure);
     },
 
@@ -760,7 +760,7 @@ BrowserID.User = (function() {
     verifyEmailWithPassword: function(token, pass, onComplete, onFailure) {
       User.verifyEmailNoPassword(token, function(userInfo) {
         var invalidInfo = { valid: false };
-        if(userInfo.status !== false) {
+        if (userInfo.status !== false) {
           User.setPassword(pass, function(status) {
             onComplete(status ? userInfo : invalidInfo);
           }, onFailure);
@@ -866,13 +866,13 @@ BrowserID.User = (function() {
             }, 0);
           }
           else {
-            if(storedID.type === "primary") {
+            if (storedID.type === "primary") {
               // first we have to get the address info, then attempt
               // a provision, then if the user is provisioned, go and get an
               // assertion.
               network.addressInfo(email, function(info) {
                 User.provisionPrimaryUser(email, info, function(status) {
-                  if(status === "primary.verified") {
+                  if (status === "primary.verified") {
                     User.getAssertion(email, audience, onComplete, onFailure);
                   }
                   else {
diff --git a/resources/static/test/qunit/controllers/required_email_unit_test.js b/resources/static/test/qunit/controllers/required_email_unit_test.js
index 1964fe74f3d91940d3cd44224cae50178d189e66..9ad563aa7bf326941630bc8160edff731ed25d5b 100644
--- a/resources/static/test/qunit/controllers/required_email_unit_test.js
+++ b/resources/static/test/qunit/controllers/required_email_unit_test.js
@@ -42,7 +42,8 @@
       xhr = bid.Mocks.xhr,
       user = bid.User,
       testHelpers = bid.TestHelpers,
-      register = testHelpers.register;
+      register = testHelpers.register,
+      mediator = bid.Mediator;
 
   module("controllers/required_email", {
     setup: function() {
@@ -95,8 +96,10 @@
     equal($("#password_section").length, 0, "password section is not there");
   }
 
-  asyncTest("user who is not authenticated, email is registered", function() {
+  asyncTest("user who is not authenticated, known secondary - show password form", function() {
     var email = "registered@testuser.com";
+    xhr.useResult("known_secondary");
+
     createController({
       email: email,
       authenticated: false,
@@ -107,8 +110,10 @@
 
   });
 
-  asyncTest("user who is not authenticated, email not registered", function() {
+  asyncTest("user who is not authenticated, unknown secondary - user must verify", function() {
     var email = "unregistered@testuser.com";
+    xhr.useResult("unknown_secondary");
+
     createController({
       email: email,
       authenticated: false,
@@ -116,7 +121,26 @@
         testVerify(email);
       }
     });
+  });
+
+  asyncTest("user who is not authenticated, primary - user must validate with IdP.", function() {
+    var email = "unregistered@testuser.com",
+        msgInfo;
 
+    mediator.subscribe("primary_user", function(msg, info) {
+      msgInfo = info;
+    });
+
+    xhr.useResult("primary");
+    createController({
+      email: email,
+      authenticated: false,
+      ready: function() {
+        equal(msgInfo.email, "unregistered@testuser.com", "correct email address");
+        start();
+
+      }
+    });
   });
 
   asyncTest("user who is not authenticated, XHR error", function() {
@@ -210,6 +234,8 @@
     });
 
     var email = "registered@testuser.com";
+    xhr.useResult("known_secondary");
+
     createController({
       email: email,
       authenticated: false,
@@ -219,6 +245,8 @@
           start();
         });
 
+        xhr.useResult("valid");
+
         $("#password").val("password");
         controller.signIn();
       }
@@ -233,6 +261,8 @@
     });
 
     var email = "registered@testuser.com";
+    xhr.useResult("known_secondary");
+
     createController({
       email: email,
       authenticated: false,