function _bakery_register_submit in Bakery Single Sign-On System 8.2
Same name and namespace in other branches
- 6.2 bakery.module \_bakery_register_submit()
- 7.2 bakery.module \_bakery_register_submit()
- 7.3 bakery.module \_bakery_register_submit()
Handle registration by redirecting to master.
File
- ./
bakery.module, line 249 - For implementing different hooks for bakery SSO functionality.
Code
function _bakery_register_submit($form, &$form_state) {
// Create an array of fields to send to the master.
// Save values to cookie.
$data = [
"name" => $form_state
->getValue('name'),
"pass" => $form_state
->getValue('pass'),
"mail" => $form_state
->getValue('mail'),
];
_bakery_save_destination_param($form, $data);
unset($_GET['destination']);
// Store name and email in case of error and return from master.
$_SESSION['bakery']['register'] = [
'name' => $data['name'],
'mail' => $data['mail'],
];
// 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';
$form_state
->setFormState([
'redirect' => new TrustedRedirectResponse($master_uri),
]);
}