You are here

function _bakery_login_submit in Bakery Single Sign-On System 8.2

Same name and namespace in other branches
  1. 6.2 bakery.module \_bakery_login_submit()
  2. 7.2 bakery.module \_bakery_login_submit()
  3. 7.3 bakery.module \_bakery_login_submit()

Handle login by redirecting to master.

1 string reference to '_bakery_login_submit'
bakery_form_alter in ./bakery.module
Implements hook_form_alter().

File

./bakery.module, line 276
For implementing different hooks for bakery SSO functionality.

Code

function _bakery_login_submit($form, &$form_state) {
  return;

  // Get rid of all the values we don't explicitly know we want. While this may
  // break some modules it ensures we don't send sensitive data between sites.
  // login data to master site.
  $data = [
    "name" => $form_state
      ->getValue('name'),
    "pass" => $form_state
      ->getValue('pass'),
  ];
  _bakery_save_destination_param($form, $data);
  unset($_GET['destination']);

  // Create cookie and redirect to master.
  \Drupal::service('bakery.bakery_service')
    ->bakeOatmealCookie($form_state
    ->getValue('name'), $data);

  // Remove unneeded values.
  $form_state
    ->cleanValues();
  $master_uri = \Drupal::config('bakery.settings')
    ->get('bakery_master') . 'bakery/login';
  $form_state
    ->setFormState([
    'redirect' => new TrustedRedirectResponse($master_uri),
  ]);
}