docs: function renderLoginFormWithError(req, res, config, err) {
    var logger = req.app.get('stormpathLogger');
    var view = config.web.login.view;
    var nextUri = url.parse(req.query.next || '').path;
    var encodedNextUri = encodeURIComponent(nextUri);
    var formActionUri = config.web.login.uri + (nextUri ? ('?next=' + encodedNextUri) : '');
    var oauthStateToken = common.resolveStateToken(req, res);
  
    var providers = buildProviderModel(req, res);
  
    var hasSocialProviders = !!Object.keys(config.web.social || {}).length;
  
    // Stormpath is unable to create or update the account because the
    // Facebook or Google response did not contain the required property.
    if (err.code === 7201) {
      logger.info('Provider login error: ' + err.message);
      err.userMessage = 'Login failed, because we could not retrieve your email address from the provider.  Please ensure that you have granted email permission to our application.';
    }
  
    getFormViewModel('login', config, function (err2, viewModel) {
  
      err = err2 || err;
  
      var options = {
        form: forms.loginForm,
        formActionUri: formActionUri,
        oauthStateToken: oauthStateToken,
        hasSocialProviders: hasSocialProviders,
        socialProviders: providers,
        error: err.userMessage || err.message,
        formModel: viewModel.form
      };
  
      render(req, res, view, options);
    });
  }