lib/controllers/login.js
function (form) {
              if (config.web.multiTenancy.enabled && req.organization) {
                setAccountStoreByHref(form.data, req.organization);
              } else {
                /**
                 * Delete this form field, it's automatically added by the
                 * forms library.  If we don't delete it, we submit a null
                 * name key to the REST API and we get an error.
                 */
                delete form.data.organizationNameKey;
              }

              helpers.authenticate(form.data, req, res, function (err) {
                if (err) {
                  if (err.code === 2014) {
                    err.message = err.userMessage = 'Invalid Username, Password, or Organization';
                  }

                  err = oktaErrorTransformer(err);

                  return renderForm(form, { error: err.userMessage || err.message });
                }

                helpers.loginResponder(req, res);
              });
            }
function (form) {
              if (config.web.multiTenancy.enabled && req.organization) {
                setAccountStoreByHref(form.data, req.organization);
              } else {
                /**
                 * Delete this form field, it's automatically added by the
                 * forms library.  If we don't delete it, we submit a null
                 * name key to the REST API and we get an error.
                 */
                delete form.data.organizationNameKey;
              }

              helpers.authenticate(form.data, req, res, function (err) {
                if (err) {
                  if (err.code === 2014) {
                    err.message = err.userMessage = 'Invalid Username, Password, or Organization';
                  }

                  err = oktaErrorTransformer(err);

                  return renderForm(form, { error: err.userMessage || err.message });
                }

                helpers.loginResponder(req, res);
              });
            }
function ( form ) { if ( config . web . multiTenancy . enabled && req . organization ) { setAccountStoreByHref ( form . data , req . organization ) ; } else { /**
                 * Delete this form field, it's automatically added by the
                 * forms library.  If we don't delete it, we submit a null
                 * name key to the REST API and we get an error.
                 */ delete form . data . organizationNameKey ; } helpers . authenticate ( form . data , req , res , function ( err ) { if ( err ) { if ( err . code === 2014 ) { err . message = err . userMessage = 'Invalid Username, Password, or Organization' ; } err = oktaErrorTransformer ( err ) ; return renderForm ( form , { error : err . userMessage || err . message } ) ; } helpers . loginResponder ( req , res ) ; } ) ; }
If we get here, it means the user is submitting a login request, so we should attempt to log the user into their account.
If we get here it means the user is submitting a login request so we should attempt to log the user into their account .