function()

in javascript/widgets/handler/callback.js [283:349]


    function(app, component, email, opt_infoBarMessage) {
  var container = component.getContainer();
  app.registerPending(app.getAuth().fetchSignInMethodsForEmail(email)
      .then(function(signInMethods) {
        component.dispose();
        if (!signInMethods.length) {
          // No ability to link. Clear pending email credential.
          firebaseui.auth.storage.removePendingEmailCredential(app.getAppId());
          // Edge case scenario: anonymous account exists with the current
          // email. Linking will be required and providers array will be empty.
          // Provide a way for user to recover. Only way is via password reset.
          firebaseui.auth.widget.handler.handle(
              firebaseui.auth.widget.HandlerName.PASSWORD_RECOVERY,
              app,
              container,
              email,
              // Allow the user to cancel.
              false,
              // Display a message to explain to the user what happened.
              firebaseui.auth.soy2.strings.errorAnonymousEmailBlockingSignIn()
                .toString());
        } else if (goog.array.contains(signInMethods,
            firebase.auth.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD)) {
          // In this scenario, there can't be any error message passed from a
          // auth/user-cancelled error, as the sign in method is password.
          firebaseui.auth.widget.handler.handle(
              firebaseui.auth.widget.HandlerName.PASSWORD_LINKING,
              app,
              container,
              email);
        } else if (signInMethods.length == 1 && signInMethods[0] ===
            firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD) {
          // In this scenario, there can't be any error message passed from a
          // auth/user-cancelled error, as the sign in method is email link.
          firebaseui.auth.widget.handler.handle(
              firebaseui.auth.widget.HandlerName.EMAIL_LINK_SIGN_IN_LINKING,
              app,
              container,
              email);
        } else {
          var federatedSignInMethod =
              firebaseui.auth.idp.getFirstFederatedSignInMethod(
                  signInMethods, app.getConfig().getProviders());
          if (federatedSignInMethod) {
            firebaseui.auth.widget.handler.handle(
                firebaseui.auth.widget.HandlerName.FEDERATED_LINKING,
                app,
                container,
                email,
                federatedSignInMethod,
                opt_infoBarMessage);
          } else {
            // No ability to link. Clear pending email credential.
            firebaseui.auth.storage.removePendingEmailCredential(
                app.getAppId());
            firebaseui.auth.widget.handler.handle(
                firebaseui.auth.widget.HandlerName.UNSUPPORTED_PROVIDER,
                app,
                container,
                email);
          }
        }
      }, function(error) {
        firebaseui.auth.widget.handler.handleCallbackFailure_(
              app, component, /** @type {!Error} */ (error));
      }));
};